blob: c47eb60f0fcfbe9695abb327961965d7c2a7db40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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')
})
}
})
})
|