diff --git a/svelte-v1.20.2-keyed/index.html b/svelte-v1.20.2-keyed/index.html new file mode 100644 index 000000000..9890eb0e0 --- /dev/null +++ b/svelte-v1.20.2-keyed/index.html @@ -0,0 +1,12 @@ + + + + Svelte v1.8.1 + + + +
+
+ + + diff --git a/svelte-v1.20.2-keyed/package.json b/svelte-v1.20.2-keyed/package.json new file mode 100644 index 000000000..0da10c0db --- /dev/null +++ b/svelte-v1.20.2-keyed/package.json @@ -0,0 +1,26 @@ +{ + "name": "js-framework-benchmark-svelte", + "version": "1.0.0", + "description": "Boilerplate for Svelte", + "scripts": { + "build-dev": "rollup -c -w", + "build-prod": "rollup -c --environment production" + }, + "keywords": [ + "svelte" + ], + "author": "Stefan Krause", + "license": "Apache-2.0", + "homepage": "https://github.com/krausest/js-framework-benchmark", + "repository": { + "type": "git", + "url": "https://github.com/krausest/js-framework-benchmark.git" + }, + "devDependencies": { + "rollup": "0.41.6", + "rollup-plugin-buble": "0.15.0", + "rollup-plugin-svelte": "1.8.1", + "rollup-plugin-uglify": "1.0.2", + "svelte": "1.20.2" + } +} diff --git a/svelte-v1.20.2-keyed/rollup.config.js b/svelte-v1.20.2-keyed/rollup.config.js new file mode 100644 index 000000000..d8b65d361 --- /dev/null +++ b/svelte-v1.20.2-keyed/rollup.config.js @@ -0,0 +1,19 @@ +import svelte from 'rollup-plugin-svelte'; +import buble from 'rollup-plugin-buble'; +import uglify from 'rollup-plugin-uglify'; + +const plugins = [ + svelte(), + buble() +]; + +if ( process.env.production ) { + plugins.push( uglify() ); +} + +export default { + entry: 'src/main.es6.js', + dest: 'dist/main.js', + format: 'iife', + plugins +}; diff --git a/svelte-v1.20.2-keyed/src/DataStore.js b/svelte-v1.20.2-keyed/src/DataStore.js new file mode 100644 index 000000000..5922e81da --- /dev/null +++ b/svelte-v1.20.2-keyed/src/DataStore.js @@ -0,0 +1,52 @@ +export default class DataStore { + constructor() { + this.data = []; + this.selected = undefined; + this.id = 1; + } + buildData(count = 1000) { + var adjectives = ["pretty", "large", "big", "small", "tall", "short", "long", "handsome", "plain", "quaint", "clean", "elegant", "easy", "angry", "crazy", "helpful", "mushy", "odd", "unsightly", "adorable", "important", "inexpensive", "cheap", "expensive", "fancy"]; + var colours = ["red", "yellow", "blue", "green", "pink", "brown", "purple", "brown", "white", "black", "orange"]; + var nouns = ["table", "chair", "house", "bbq", "desk", "car", "pony", "cookie", "sandwich", "burger", "pizza", "mouse", "keyboard"]; + var data = []; + for (var i = 0; i < count; i++) + data.push({ id: this.id++, label: adjectives[this._random(adjectives.length)] + " " + colours[this._random(colours.length)] + " " + nouns[this._random(nouns.length)] }); + return data; + } + _random(max) { + return Math.round(Math.random() * 1000) % max; + } + select(id) { + this.selected = id; + } + update() { + for (let i=0;i d.id==id); + this.data.splice(idx, 1); + } + run() { + this.data = this.buildData(); + } + add() { + this.data.push.apply(this.data, this.buildData(1000)); + } + runLots() { + this.data = this.buildData(10000); + this.selected = undefined; + } + clear() { + this.data = []; + this.selected = undefined; + } + swapRows() { + if(this.data.length > 10) { + var a = this.data[4]; + this.data[4] = this.data[9]; + this.data[9] = a; + } + } +} diff --git a/svelte-v1.20.2-keyed/src/Main.html b/svelte-v1.20.2-keyed/src/Main.html new file mode 100644 index 000000000..7ac4bd2bb --- /dev/null +++ b/svelte-v1.20.2-keyed/src/Main.html @@ -0,0 +1,134 @@ +
+
+
+

Svelte v1.8.1

+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+ + + {{#each store.data as row, num @id}} + + + + + + + {{/each}} + +
{{row.id}} + {{row.label}} +
+ + + diff --git a/svelte-v1.20.2-keyed/src/main.es6.js b/svelte-v1.20.2-keyed/src/main.es6.js new file mode 100644 index 000000000..84815842f --- /dev/null +++ b/svelte-v1.20.2-keyed/src/main.es6.js @@ -0,0 +1,5 @@ +import Main from './Main.html'; + +window.s = new Main({ + target: document.querySelector( '#main' ) +}); diff --git a/svelte-v1.20.2-non-keyed/index.html b/svelte-v1.20.2-non-keyed/index.html new file mode 100644 index 000000000..9890eb0e0 --- /dev/null +++ b/svelte-v1.20.2-non-keyed/index.html @@ -0,0 +1,12 @@ + + + + Svelte v1.8.1 + + + +
+
+ + + diff --git a/svelte-v1.20.2-non-keyed/package.json b/svelte-v1.20.2-non-keyed/package.json new file mode 100644 index 000000000..0da10c0db --- /dev/null +++ b/svelte-v1.20.2-non-keyed/package.json @@ -0,0 +1,26 @@ +{ + "name": "js-framework-benchmark-svelte", + "version": "1.0.0", + "description": "Boilerplate for Svelte", + "scripts": { + "build-dev": "rollup -c -w", + "build-prod": "rollup -c --environment production" + }, + "keywords": [ + "svelte" + ], + "author": "Stefan Krause", + "license": "Apache-2.0", + "homepage": "https://github.com/krausest/js-framework-benchmark", + "repository": { + "type": "git", + "url": "https://github.com/krausest/js-framework-benchmark.git" + }, + "devDependencies": { + "rollup": "0.41.6", + "rollup-plugin-buble": "0.15.0", + "rollup-plugin-svelte": "1.8.1", + "rollup-plugin-uglify": "1.0.2", + "svelte": "1.20.2" + } +} diff --git a/svelte-v1.20.2-non-keyed/rollup.config.js b/svelte-v1.20.2-non-keyed/rollup.config.js new file mode 100644 index 000000000..d8b65d361 --- /dev/null +++ b/svelte-v1.20.2-non-keyed/rollup.config.js @@ -0,0 +1,19 @@ +import svelte from 'rollup-plugin-svelte'; +import buble from 'rollup-plugin-buble'; +import uglify from 'rollup-plugin-uglify'; + +const plugins = [ + svelte(), + buble() +]; + +if ( process.env.production ) { + plugins.push( uglify() ); +} + +export default { + entry: 'src/main.es6.js', + dest: 'dist/main.js', + format: 'iife', + plugins +}; diff --git a/svelte-v1.20.2-non-keyed/src/DataStore.js b/svelte-v1.20.2-non-keyed/src/DataStore.js new file mode 100644 index 000000000..5922e81da --- /dev/null +++ b/svelte-v1.20.2-non-keyed/src/DataStore.js @@ -0,0 +1,52 @@ +export default class DataStore { + constructor() { + this.data = []; + this.selected = undefined; + this.id = 1; + } + buildData(count = 1000) { + var adjectives = ["pretty", "large", "big", "small", "tall", "short", "long", "handsome", "plain", "quaint", "clean", "elegant", "easy", "angry", "crazy", "helpful", "mushy", "odd", "unsightly", "adorable", "important", "inexpensive", "cheap", "expensive", "fancy"]; + var colours = ["red", "yellow", "blue", "green", "pink", "brown", "purple", "brown", "white", "black", "orange"]; + var nouns = ["table", "chair", "house", "bbq", "desk", "car", "pony", "cookie", "sandwich", "burger", "pizza", "mouse", "keyboard"]; + var data = []; + for (var i = 0; i < count; i++) + data.push({ id: this.id++, label: adjectives[this._random(adjectives.length)] + " " + colours[this._random(colours.length)] + " " + nouns[this._random(nouns.length)] }); + return data; + } + _random(max) { + return Math.round(Math.random() * 1000) % max; + } + select(id) { + this.selected = id; + } + update() { + for (let i=0;i d.id==id); + this.data.splice(idx, 1); + } + run() { + this.data = this.buildData(); + } + add() { + this.data.push.apply(this.data, this.buildData(1000)); + } + runLots() { + this.data = this.buildData(10000); + this.selected = undefined; + } + clear() { + this.data = []; + this.selected = undefined; + } + swapRows() { + if(this.data.length > 10) { + var a = this.data[4]; + this.data[4] = this.data[9]; + this.data[9] = a; + } + } +} diff --git a/svelte-v1.20.2-non-keyed/src/Main.html b/svelte-v1.20.2-non-keyed/src/Main.html new file mode 100644 index 000000000..7731676c5 --- /dev/null +++ b/svelte-v1.20.2-non-keyed/src/Main.html @@ -0,0 +1,134 @@ +
+
+
+

Svelte v1.8.1

+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+ + + {{#each store.data as row, num}} + + + + + + + {{/each}} + +
{{row.id}} + {{row.label}} +
+ + + diff --git a/svelte-v1.20.2-non-keyed/src/main.es6.js b/svelte-v1.20.2-non-keyed/src/main.es6.js new file mode 100644 index 000000000..84815842f --- /dev/null +++ b/svelte-v1.20.2-non-keyed/src/main.es6.js @@ -0,0 +1,5 @@ +import Main from './Main.html'; + +window.s = new Main({ + target: document.querySelector( '#main' ) +});