summaryrefslogtreecommitdiffstats
path: root/bench/tests/10000-pointArray-bbox.js
diff options
context:
space:
mode:
Diffstat (limited to 'bench/tests/10000-pointArray-bbox.js')
-rw-r--r--bench/tests/10000-pointArray-bbox.js49
1 files changed, 36 insertions, 13 deletions
diff --git a/bench/tests/10000-pointArray-bbox.js b/bench/tests/10000-pointArray-bbox.js
index 32bc21a..8c9c42c 100644
--- a/bench/tests/10000-pointArray-bbox.js
+++ b/bench/tests/10000-pointArray-bbox.js
@@ -1,29 +1,52 @@
-SVG.bench.describe('Generate 10000 pathArrays bbox', function(bench) {
- var data = '209,153 389,107 547,188 482,289 374,287 91,254 407,243 391,185 166,226 71,177 65,52 234,50 107,136 163,199 158,131 323,45 218,145 305,190 374,143 174,216 296,241'
+SVG.bench.describe('Generate 10000 pathArrays bbox', function (bench) {
+ var data =
+ '209,153 389,107 547,188 482,289 374,287 91,254 407,243 391,185 166,226 71,177 65,52 234,50 107,136 163,199 158,131 323,45 218,145 305,190 374,143 174,216 296,241'
- var dataArr = [[209,153],[389,107],[547,188],[482,289],[374,287],[91,254],[407,243],[391,185],[166,226],[71,177],[65,52],[234,50],[107,136],[163,199],[158,131],[323,45],[218,145],[305,190],[374,143],[174,216],[296,241]]
+ var dataArr = [
+ [209, 153],
+ [389, 107],
+ [547, 188],
+ [482, 289],
+ [374, 287],
+ [91, 254],
+ [407, 243],
+ [391, 185],
+ [166, 226],
+ [71, 177],
+ [65, 52],
+ [234, 50],
+ [107, 136],
+ [163, 199],
+ [158, 131],
+ [323, 45],
+ [218, 145],
+ [305, 190],
+ [374, 143],
+ [174, 216],
+ [296, 241]
+ ]
-
- bench.test('using SVG.js v3.0.0', function() {
+ bench.test('using SVG.js v3.0.0', function () {
for (var i = 0; i < 10000; i++) {
SVG.parser.poly.setAttribute('points', data)
SVG.parser.poly.getBBox()
}
})
-
- bench.test('using SVG.js v3.0.0 without parser', function() {
+ bench.test('using SVG.js v3.0.0 without parser', function () {
for (var i = 0; i < 10000; i++) {
- var maxX = -Infinity, maxY = -Infinity, minX = Infinity, minY = Infinity
- dataArr.forEach(function(el) {
+ var maxX = -Infinity,
+ maxY = -Infinity,
+ minX = Infinity,
+ minY = Infinity
+ dataArr.forEach(function (el) {
maxX = Math.max(el[0], maxX)
maxY = Math.max(el[1], maxY)
minX = Math.min(el[0], minX)
minY = Math.min(el[1], minY)
})
- var a = {x: minX, y: minY, width: maxX-minX, height: maxY-minY}
+ var a = { x: minX, y: minY, width: maxX - minX, height: maxY - minY }
}
- //new SVG.Path().attr('d', data).addTo(draw).bbox()
+ //new SVG.Path().attr('d', data).addTo(draw).bbox()
})
-
-}) \ No newline at end of file
+})