Closed GoogleCodeExporter closed 9 years ago
could you send a patch file?
Original comment by moo...@wwwendt.de
on 17 Oct 2010 at 8:22
I've attached the modified version.
Original comment by prana001
on 17 Oct 2010 at 8:27
Attachments:
Have you made any benchmarks or anything else that would detail 'working a bit
smoother'?
(it would be easier to apply the changes, if you sent a patch file ('svn diff').
Anyway: thanks!
Original comment by moo...@wwwendt.de
on 17 Oct 2010 at 8:50
Benchmark results (IE 8)
1.100000 x for() took 18 milliseconds (5555556 operations/sec)
2.100000 x reverse-for() took 6 milliseconds (16666667 operations/sec)
3.100000 x array iterator for() took 106 milliseconds (943396 operations/sec)
4.100000 x array iterator cached-length took 70 milliseconds (1428571 operations/sec)
5.100000 x array iterator reverse for() took 75 milliseconds (1333333 operations/sec)
Benchmark results (Firefox 3.6)
1. 100000 x for() took 8 milliseconds (12500000 operations/sec)
2. 100000 x reverse-for() took 4 milliseconds (25000000 operations/sec)
3. 100000 x array iterator for() took 29 milliseconds (3448276 operations/sec)
4. 100000 x array iterator cached-length took 22 milliseconds (4545455 operations/sec)
5. 100000 x array iterator reverse for() took 20 milliseconds (5000000 operations/sec)
Benchmark results (Google Chrome 7)
100000 x for() took 0 milliseconds
100000 x reverse-for() took 0 milliseconds
100000 x array iterator for() took 17 milliseconds (5882353 operations/sec)
100000 x array iterator cached-length took 14 milliseconds (7142857 operations/sec)
100000 x array iterator reverse for() took 15 milliseconds (6666667 operations/sec)
Test suite:
-----------
test("Core benchmarks", function() {
expect(5);
var loopCount = 100000;
benchmark(loopCount + " x for()", loopCount, function(){
for(var i=0; i<loopCount; i++) {
// no-op
}
});
benchmark(loopCount + " x reverse-for()", loopCount, function(){
for(var i=loopCount; i--; ) {
// no-op
}
});
var arr = new Array(loopCount);
benchmark(loopCount + " x array iterator for()", loopCount, function(){
for(var i=0; i<arr.length - 1; i++) {
var e = arr[i];
// no-op
}
});
benchmark(loopCount + " x array iterator cached-length", loopCount, function(){
for(var i=0, l=arr.length - 1; i<l; i++) {
var e = arr[i];
// no-op
}
});
benchmark(loopCount + " x array iterator reverse for()", loopCount, function(){
for(var i=arr.length - 1; i--; ) {
var e = arr[i];
// no-op
}
});
});
Original comment by moo...@wwwendt.de
on 31 Oct 2010 at 11:22
Yeah, Nice numbers!
Never knew a reverse-for can be almost twice as fast???!
Original comment by prana001
on 31 Oct 2010 at 11:33
Original comment by moo...@wwwendt.de
on 21 Nov 2010 at 7:14
Original comment by moo...@wwwendt.de
on 21 Nov 2010 at 7:26
This issue was closed by revision r439.
Original comment by moo...@wwwendt.de
on 11 Dec 2010 at 7:46
Original comment by moo...@wwwendt.de
on 12 Dec 2010 at 8:41
considered verified
Original comment by moo...@wwwendt.de
on 17 Jul 2012 at 4:16
Original comment by moo...@wwwendt.de
on 17 Jul 2012 at 4:19
Original issue reported on code.google.com by
prana001
on 17 Oct 2010 at 2:59