#####################################
function loop2(y) {
var len = 1000*1000*10;
var object = {};
var start = Date.now();
object[y] = "someValue";
while (len--) {
object[y] = "someValue";
}
return Date.now()-start;
};
function loop(y) {
var len = 1000*1000*10;
var object = {};
var start = Date.now();
while (len--) {
object[y] = "someValue";
}
return Date.now()-start;
};
var x = "test101"; // this is fast
var y = "test" + "101"; // this is slower ???
var tries = 10;
while (tries--) {
console.log("Fast:" + loop2(x));
console.log("Slow:" + loop(y));
}
####################################
regards, Peter
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
receiver and key seen, it is not a good idea to mix different types of keys at the same access site.
...
called map transition internally in V8. As a general rule, it is not a good idea to have a store that may add a property inside a loop.
On Sat, Jan 1, 2011 at 3:27 PM, Florian Schneider <fschn...@chromium.org> wrote:receiver and key seen, it is not a good idea to mix different types of keys at the same access site....called map transition internally in V8. As a general rule, it is not a good idea to have a store that may add a property inside a loop.
Jus to clarify: when you say "not a good idea," you mean only for performance reasons, right? There are no correctness issues with doing so, are there?
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
--