Re: [JS-internals] Basic loop optimization q from twitter

2014-01-20 Thread Nicholas Nethercote
On Mon, Jan 20, 2014 at 1:03 PM, hv1989 wrote: > > Just that measuring an empty loop is kinda pointless. For anyone with a twitter account: "Microbenchmarks suck!" easily fits into 140 chars. N ___ dev-tech-js-engine-internals mailing list dev-tech-js-

Re: [JS-internals] Basic loop optimization q from twitter

2014-01-20 Thread hv1989
Tested on Aurora, score: arrlen: 232 variable: 333 Like predicted. This has nothing to do about arr.length not getting hoisted. Just that measuring an empty loop is kinda pointless. On Mon, Jan 20, 2014 at 9:52 PM, Brendan Eich wrote: > Niels on twitter cited Firefox Aurora. Are you testing t

Re: [JS-internals] Basic loop optimization q from twitter

2014-01-20 Thread Brendan Eich
Niels on twitter cited Firefox Aurora. Are you testing tip shell, or Firefox Nightly? Might be worth checking out Aurora. Thanks, /be hv1989 wrote: So the given benchmark shows the speed is the same. ___ dev-tech-js-engine-internals mailing list dev

Re: [JS-internals] Basic loop optimization q from twitter

2014-01-20 Thread hv1989
So the given benchmark shows the speed is the same. And looking at the spew of IonMonkey of LICM we do hoist the array.length. But like said, small changes to the microbenchmark could change the speed due to different things: - compiled with OSR entry - register allocation that require a move - ca

Re: [JS-internals] Basic loop optimization q from twitter

2014-01-20 Thread Brendan Eich
hv1989 wrote: This is really micro micro benchmarking. I mean the difference you measure possibly isn't because we output different code, but due to processor handling of the code. Would more iterations help? /be ___ dev-tech-js-engine-internals mai

Re: [JS-internals] Basic loop optimization q from twitter

2014-01-20 Thread hv1989
We indeed can and do hoist array.length if we can observe it definitely doesn't change. In the micro-benchmark provided we definitely can: test.js: function test_arr_length() { var arr = [1,2,3,4,5,6,8,43,43,4,432,432,432,432,432,432,432,32,542543,6536,5354,5,2532,432,4546,36,345,243,4,436,5,654

[JS-internals] Basic loop optimization q from twitter

2014-01-20 Thread Brendan Eich
Jan, anyone: https://twitter.com/phidip/status/425337790872973312 "In JS array.length is a property. Why is for(i=0;islower than for(i=0,len=array,length;i Feel free to contact Niels directly (http://wefollow.com/phidip). Thanks, /be ___ dev-tech-js-