mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
3c35cd4a74
Implement defining properties via V8's `v8::Object::CreateDataProperty()`, which is faster for data-valued, writable, configurable, and enumerable properties. Re: https://github.com/nodejs/node/issues/45905 Signed-off-by: Gabriel Schulhof <gabrielschulhof@gmail.com> PR-URL: https://github.com/nodejs/node/pull/48440 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
16 lines
357 B
JavaScript
16 lines
357 B
JavaScript
'use strict';
|
|
|
|
const common = require('../../common.js');
|
|
|
|
const binding = require(`./build/${common.buildType}/binding`);
|
|
|
|
const bench = common.createBenchmark(main, {
|
|
n: [5e6],
|
|
implem: ['runFastPath', 'runSlowPath'],
|
|
});
|
|
|
|
function main({ n, implem }) {
|
|
const objs = Array(n).fill(null).map((item) => new Object());
|
|
binding[implem](bench, objs);
|
|
}
|