New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: parameter object is null object #333
base: main
Are you sure you want to change the base?
Conversation
tests fail because of tap issues... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleaner and Simpler
new Function('paramsArray', `return { __proto__:null,${lines.join(',')}}`)
Need to benchmark. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this shoukd be a semver-major change.
It seems that new NullObject is faster than using proto trick node benchmark/null-object.js
new NullObject() x 1,377,691,231 ops/sec ±0.11% (194 runs sampled)
{__proto__: null } x 33,097,458 ops/sec ±0.50% (185 runs sampled) 'use strict'
const { NullObject } = require('../lib/null-object')
const Benchmark = require('benchmark')
Benchmark.options.minSamples = 100
const suite = Benchmark.Suite()
suite.add(`new NullObject()`, function () {
const result = new NullObject()
})
suite.add(`{__proto__: null }`, function () {
const result = {__proto__: null }
})
suite
.on('cycle', function (event) {
console.log(String(event.target))
})
.on('complete', function () {
})
.run() |
Can you exclude windows v14 from CI? |
@mcollina done. I would like to write another benchmark for the actual parameter generation. So please dont merge to fast. I posted my benchmark to discuss if proto is the right way or not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm looks nice!
PTAL @ivan-tymoshenko |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@Uzlopak Can you post the bechmarks comparison pls? |
can you merge main? |
@mcollina done |
see fastify/fastify#4357
@Eomm
@mcollina
@jsumners
I did not bench