diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2017-04-22 20:31:58 +0200 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2017-04-22 20:31:58 +0200 |
commit | 408940add58e81e7879098682e94504a8cf3a734 (patch) | |
tree | b7d1a4c2bc659bdafe50097c6a0e9921cbbf9ee1 /bench | |
parent | 60d3ad099f3ee1a39b401d12405dba9e4d7e5da2 (diff) | |
parent | 04e21b18c30d546ed6a16b279504a2b58b503541 (diff) | |
download | svg.js-408940add58e81e7879098682e94504a8cf3a734.tar.gz svg.js-408940add58e81e7879098682e94504a8cf3a734.zip |
Merge branch 'master' into 3.0.0
# Conflicts - all resolved:
# dist/svg.js
# dist/svg.min.js
# package.json
# spec/SpecRunner.html
# spec/spec/boxes.js
# spec/spec/element.js
# spec/spec/image.js
# spec/spec/svg.js
# src/boxes.js
# src/flatten.js
# src/image.js
# src/polyfill.js
# src/style.js
# src/svg.js
Diffstat (limited to 'bench')
-rw-r--r-- | bench/runner.html | 1 | ||||
-rw-r--r-- | bench/tests/10000-circles.js | 4 | ||||
-rw-r--r-- | bench/tests/10000-each.js | 27 | ||||
-rw-r--r-- | bench/tests/10000-pathArrays.js | 6 | ||||
-rw-r--r-- | bench/tests/10000-paths.js | 2 | ||||
-rw-r--r-- | bench/tests/10000-rects.js | 8 |
6 files changed, 38 insertions, 10 deletions
diff --git a/bench/runner.html b/bench/runner.html index a0bc5d9..1a2f727 100644 --- a/bench/runner.html +++ b/bench/runner.html @@ -40,6 +40,7 @@ <script src="../dist/svg.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/snap.svg/0.5.1/snap.svg-min.js"></script> <script src="svg.bench.js"></script> + <!-- <script src="tests/10000-each.js"></script> --> <script src="tests/10000-rects.js"></script> <script src="tests/10000-circles.js"></script> <script src="tests/10000-paths.js"></script> diff --git a/bench/tests/10000-circles.js b/bench/tests/10000-circles.js index da2a3de..f090281 100644 --- a/bench/tests/10000-circles.js +++ b/bench/tests/10000-circles.js @@ -1,5 +1,5 @@ SVG.bench.describe('Generate 10000 circles', function(bench) { - bench.test('using SVG.js v2.4.0', function() { + bench.test('using SVG.js v2.5.3', function() { for (var i = 0; i < 10000; i++) bench.draw.circle(100,100) }) @@ -18,7 +18,7 @@ SVG.bench.describe('Generate 10000 circles', function(bench) { }) SVG.bench.describe('Generate 10000 circles with fill', function(bench) { - bench.test('using SVG.js v2.4.0', function() { + bench.test('using SVG.js v2.5.3', function() { for (var i = 0; i < 10000; i++) bench.draw.circle(100,100).fill('#f06') }) 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 diff --git a/bench/tests/10000-pathArrays.js b/bench/tests/10000-pathArrays.js index fc34e5f..a4c0fdc 100644 --- a/bench/tests/10000-pathArrays.js +++ b/bench/tests/10000-pathArrays.js @@ -5,17 +5,17 @@ SVG.bench.describe('Generate 10000 pathArrays', function(bench) { var data3 = 'M10 10-45-30.5.5 .89L2e-2.5.5.5-.5C.5.5.5.5.5.5L-3-4z' - bench.test('using SVG.js v2.4.0', function() { + bench.test('using SVG.js v2.5.3', function() { for (var i = 0; i < 10000; i++) new SVG.PathArray(data) }) - bench.test('using SVG.js v2.4.0 more data', function() { + bench.test('using SVG.js v2.5.3 more data', function() { for (var i = 0; i < 10000; i++) new SVG.PathArray(data2) }) - bench.test('using SVG.js v2.4.0 complicated data', function() { + bench.test('using SVG.js v2.5.3 complicated data', function() { for (var i = 0; i < 10000; i++) new SVG.PathArray(data3) }) diff --git a/bench/tests/10000-paths.js b/bench/tests/10000-paths.js index 378cb29..cdf1d22 100644 --- a/bench/tests/10000-paths.js +++ b/bench/tests/10000-paths.js @@ -1,7 +1,7 @@ SVG.bench.describe('Generate 10000 paths', function(bench) { var data = 'M 100 200 C 200 100 300 0 400 100 C 500 200 600 300 700 200 C 800 100 900 100 900 100' - bench.test('using SVG.js v2.4.0', function() { + bench.test('using SVG.js v2.5.3', function() { for (var i = 0; i < 10000; i++) bench.draw.path(data) }) diff --git a/bench/tests/10000-rects.js b/bench/tests/10000-rects.js index dee09b4..aea0c79 100644 --- a/bench/tests/10000-rects.js +++ b/bench/tests/10000-rects.js @@ -1,5 +1,5 @@ SVG.bench.describe('Generate 10000 rects', function(bench) { - bench.test('using SVG.js v2.4.0', function() { + bench.test('using SVG.js v2.5.3', function() { for (var i = 0; i < 10000; i++) bench.draw.rect(100,100) }) @@ -19,7 +19,7 @@ SVG.bench.describe('Generate 10000 rects', function(bench) { SVG.bench.describe('Generate 10000 rects with fill', function(bench) { - bench.test('using SVG.js v2.4.0', function() { + bench.test('using SVG.js v2.5.3', function() { for (var i = 0; i < 10000; i++) bench.draw.rect(100,100).fill('#f06') }) @@ -40,7 +40,7 @@ SVG.bench.describe('Generate 10000 rects with fill', function(bench) { SVG.bench.describe('Generate 10000 rects with position and fill', function(bench) { - bench.test('using SVG.js v2.4.0', function() { + bench.test('using SVG.js v2.5.3', function() { for (var i = 0; i < 10000; i++) bench.draw.rect(100,100).move(50,50).fill('#f06') }) @@ -63,7 +63,7 @@ SVG.bench.describe('Generate 10000 rects with position and fill', function(bench SVG.bench.describe('Generate 10000 rects with gradient fill', function(bench) { - bench.test('using SVG.js v2.4.0', function() { + bench.test('using SVG.js v2.5.3', function() { for (var i = 0; i < 10000; i++) { var g = bench.draw.gradient('linear', function(stop) { stop.at(0, '#000') |