javascript - Chrome thinks 99,999 is drastically different than 100,000 -



javascript - Chrome thinks 99,999 is drastically different than 100,000 -

i ran interesting issue when posted jsperf benchmark conflicted previous, identical, benchmark ran.

chrome drastically different between these 2 lines:

new array(99999); // jsperf ~50,000 ops/sec new array(100000); // jsperf ~1,700,000 ops/sec

benchmarks: http://jsperf.com/newarrayassign/2

i wondering if has clue what's going on here!

(to clarify, i'm looking low-level details on v8 internals, such it's using different info construction 1 vs other , structures are)

just because sounded pretty interesting, searched through v8 codebase static defined 100000, , found this kinitialmaxfastelementarray var, subsequently used in builtin arrayconstructinitializeelements function function. while i'm not c programmer , don't know nitty-gritty here, can see it's using if loop determine if it's smaller 100,000, , returning @ different points based on that.

javascript google-chrome

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -