summaryrefslogtreecommitdiffstats
path: root/bench
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-24 11:17:13 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-24 11:17:13 +0100
commit858f19e9f8b9ba26eee8d3aeb8ba8b5b5058472b (patch)
treefa0c355901bf93e6dc418a759f06ab7899e0452a /bench
parent8555e13b252f07f8079b08c0b29f4399d389b1e0 (diff)
downloadsvg.js-858f19e9f8b9ba26eee8d3aeb8ba8b5b5058472b.tar.gz
svg.js-858f19e9f8b9ba26eee8d3aeb8ba8b5b5058472b.zip
Get rid of HTMLNode and Bare in favor of Dom
- words() and element() added to Dom - svg() now returns the _parent_ of the imported element, when outerHTML is true (which means an element gets replaces)
Diffstat (limited to 'bench')
-rw-r--r--bench/tests/10000-textContent.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/bench/tests/10000-textContent.js b/bench/tests/10000-textContent.js
new file mode 100644
index 0000000..9a02308
--- /dev/null
+++ b/bench/tests/10000-textContent.js
@@ -0,0 +1,21 @@
+SVG.bench.describe('Change textContent 10000 times', 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'
+
+ var node = bench.draw.plain('').node
+
+
+ bench.test('using appendChild', function() {
+ for (var i = 0; i < 1000000; i++) {
+ while (node.hasChildNodes()) {
+ node.removeChild(node.lastChild)
+ }
+
+ node.appendChild(document.createTextNode('test'+i))
+ }
+ })
+ bench.test('using textContent', function() {
+ for (var i = 0; i < 1000000; i++) {
+ node.textContent = 'test'+i
+ }
+ })
+})