diff options
author | wout <wout@mick-wout.com> | 2017-04-07 20:20:02 +0200 |
---|---|---|
committer | wout <wout@mick-wout.com> | 2017-04-07 20:20:02 +0200 |
commit | 270874248df9a034b24d49d8db00cba6529e7f4b (patch) | |
tree | 064381f2819a3b2289cc2c29383ccadae191d9cd /bench/tests/10000-each.js | |
parent | 5e9ed619e6a7ce6530b928d76a0412f364cd6bbc (diff) | |
download | svg.js-270874248df9a034b24d49d8db00cba6529e7f4b.tar.gz svg.js-270874248df9a034b24d49d8db00cba6529e7f4b.zip |
Updated CHANGELOG
Diffstat (limited to 'bench/tests/10000-each.js')
-rw-r--r-- | bench/tests/10000-each.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/bench/tests/10000-each.js b/bench/tests/10000-each.js new file mode 100644 index 0000000..c47eb60 --- /dev/null +++ b/bench/tests/10000-each.js @@ -0,0 +1,27 @@ +SVG.bench.describe('each() vs forEach()', function(bench) { + // preparation + var list = [] + + for (var i = 99; i >= 0; i--) + list.push(bench.draw.rect(100, 50)) + + var set = new SVG.Set(list) + + + bench.test('10000 x each()', function() { + for (var i = 0; i < 10000; i++) { + set.each(function() { + this.fill('#f06') + }) + } + }) + + bench.test('10000 x forEach()', function() { + for (var i = 0; i < 10000; i++) { + list.forEach(function(e) { + e.fill('#f06') + }) + } + }) + +})
\ No newline at end of file |