aboutsummaryrefslogtreecommitdiffstats
path: root/bench/tests/10000-boxes.js
diff options
context:
space:
mode:
Diffstat (limited to 'bench/tests/10000-boxes.js')
-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)
+ //})
+})