aboutsummaryrefslogtreecommitdiffstats
path: root/bench/tests
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-03-16 12:48:20 +0100
committerGitHub <noreply@github.com>2017-03-16 12:48:20 +0100
commit9bfcbc184ec99631ea7d2b912e79b1edde17a111 (patch)
tree46b78b65c8855046e471f6a5254da0b18df9c4f9 /bench/tests
parent3409a2150705f679238300c56c05ea144e9ad7bd (diff)
downloadsvg.js-9bfcbc184ec99631ea7d2b912e79b1edde17a111.tar.gz
svg.js-9bfcbc184ec99631ea7d2b912e79b1edde17a111.zip
unified all boxes (#634)
unified all boxes - SVG.Box for everything - bbox, rbox and viewbox as methods - boxes can be created with string, array, object, list... - added helper to simplify boxes code
Diffstat (limited to 'bench/tests')
-rw-r--r--bench/tests/10000-boxes.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/bench/tests/10000-boxes.js b/bench/tests/10000-boxes.js
new file mode 100644
index 0000000..0466f64
--- /dev/null
+++ b/bench/tests/10000-boxes.js
@@ -0,0 +1,55 @@
+SVG.bench.describe('Generate 100000 bbox', function(bench) {
+ var rect = bench.draw.rect(100,100)
+
+ bench.test('using SVG.js v3.0.0', function() {
+ for (var i = 0; i < 100000; i++)
+ rect.bbox()
+ })
+ //bench.test('using vanilla js', function() {
+ // var node = rect.node
+ // for (var i = 0; i < 10000; i++) {
+ // node.getBBox()
+ // }
+ //})
+ //bench.test('using Snap.svg v0.5.1', function() {
+ // for (var i = 0; i < 10000; i++)
+ // bench.snap.rect(50, 50, 100, 100)
+ //})
+})
+
+SVG.bench.describe('Generate 100000 rbox', function(bench) {
+ var rect = bench.draw.rect(100,100)
+
+ bench.test('using SVG.js v3.0.0', function() {
+ for (var i = 0; i < 100000; i++)
+ rect.bbox()
+ })
+ //bench.test('using vanilla js', function() {
+ // var node = rect.node
+ // for (var i = 0; i < 10000; i++) {
+ // node.getBoundingClientRect()
+ // }
+ //})
+ //bench.test('using Snap.svg v0.5.1', function() {
+ // for (var i = 0; i < 10000; i++)
+ // bench.snap.rect(50, 50, 100, 100)
+ //})
+})
+SVG.bench.describe('Generate 100000 viewbox', function(bench) {
+ var nested = bench.draw.nested().viewbox(10, 10, 100, 100)
+
+ bench.test('using SVG.js v3.0.0', function() {
+ for (var i = 0; i < 100000; i++)
+ nested.viewbox()
+ })
+ //bench.test('using vanilla js', function() {
+ // var node = rect.node
+ // for (var i = 0; i < 10000; i++) {
+ // node.getAttribute('viewBox')
+ // }
+ //})
+ //bench.test('using Snap.svg v0.5.1', function() {
+ // for (var i = 0; i < 10000; i++)
+ // bench.snap.rect(50, 50, 100, 100)
+ //})
+})