mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
603 B
37 lines
603 B
9 years ago
|
/*
|
||
|
* Basic property write performance
|
||
|
*/
|
||
|
|
||
|
if (typeof print !== 'function') { print = console.log; }
|
||
|
|
||
|
function test() {
|
||
|
var obj = {};
|
||
|
var i;
|
||
|
var ign;
|
||
|
|
||
|
for (i = 0; i < 32 - 1; i++) {
|
||
|
obj['prop-' + i] = 1;
|
||
|
}
|
||
|
obj['foo'] = 123;
|
||
|
|
||
|
for (i = 0; i < 1e7; i++) {
|
||
|
obj.foo = 234;
|
||
|
obj.foo = 234;
|
||
|
obj.foo = 234;
|
||
|
obj.foo = 234;
|
||
|
obj.foo = 234;
|
||
|
obj.foo = 234;
|
||
|
obj.foo = 234;
|
||
|
obj.foo = 234;
|
||
|
obj.foo = 234;
|
||
|
obj.foo = 234;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
try {
|
||
|
test();
|
||
|
} catch (e) {
|
||
|
print(e.stack || e);
|
||
|
throw e;
|
||
|
}
|