├── .gitignore ├── LICENSE ├── README.md ├── gulpfile.js ├── package.json └── web ├── config.js ├── generator.js └── index.html /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | 3 | build 4 | 5 | # Tern 6 | .tern-port 7 | 8 | # Mac 9 | .DS_Store -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, vdom-benchmark project authors. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 17 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Virtual DOM diff/patch benchmark 2 | 3 | Comparing performance of the diff/patch operations in various virtual 4 | dom libraries. 5 | 6 | - [kivi](https://github.com/localvoid/kivi) 7 | - [React](http://facebook.github.io/react/) 8 | - [Mithril](http://lhorie.github.io/mithril/index.html) 9 | - [VirtualDom](https://github.com/Matt-Esch/virtual-dom) 10 | - [Bobril](https://github.com/Bobris/Bobril) 11 | - [cito.js](https://github.com/joelrich/citojs) 12 | 13 | ## [Run benchmark](http://vdom-benchmark.github.io/vdom-benchmark/) 14 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var gulp = require('gulp'); 4 | var gulp_if = require('gulp-if'); 5 | var del = require('del'); 6 | var source = require('vinyl-source-stream'); 7 | var buffer = require('vinyl-buffer'); 8 | var sourcemaps = require('gulp-sourcemaps'); 9 | var uglify = require('gulp-uglify'); 10 | var browserify = require('browserify'); 11 | var deploy = require('gulp-gh-pages'); 12 | 13 | var browserSync = require('browser-sync'); 14 | var reload = browserSync.reload; 15 | 16 | var NODE_ENV = process.env.NODE_ENV || 'development'; 17 | var BROWSERSYNC_PORT = parseInt(process.env.BROWSERSYNC_PORT) || 3000; 18 | var RELEASE = (NODE_ENV === 'production'); 19 | var DEST = './build'; 20 | 21 | gulp.task('clean', del.bind(null, [DEST])); 22 | 23 | gulp.task('config', function() { 24 | gulp.src('./web/config.js') 25 | .pipe(gulp.dest(DEST)) 26 | .pipe(reload({stream: true})); 27 | }); 28 | 29 | gulp.task('generator', function() { 30 | var bundler = browserify({ 31 | entries: ['./web/generator.js'], 32 | debug: true 33 | }); 34 | 35 | return bundler 36 | .bundle() 37 | .pipe(source('generator.js')) 38 | .pipe(buffer()) 39 | .pipe(sourcemaps.init({loadMaps: true})) 40 | .pipe(gulp_if(RELEASE, uglify())) 41 | .pipe(sourcemaps.write('./')) 42 | .pipe(gulp.dest(DEST)) 43 | .pipe(reload({stream: true})); 44 | }); 45 | 46 | gulp.task('html', function() { 47 | gulp.src('./web/*.html') 48 | .pipe(gulp.dest(DEST)) 49 | .pipe(reload({stream: true})); 50 | }); 51 | 52 | gulp.task('serve', ['default'], function() { 53 | browserSync({ 54 | open: false, 55 | port: BROWSERSYNC_PORT, 56 | notify: false, 57 | server: 'build' 58 | }); 59 | 60 | gulp.watch('./web/config.js', ['config']); 61 | gulp.watch('./web/generator.js', ['generator']); 62 | gulp.watch('./web/**/*.html', ['html']); 63 | }); 64 | 65 | gulp.task('deploy', ['default'], function () { 66 | return gulp.src(DEST + '/**/*') 67 | .pipe(deploy()); 68 | }); 69 | 70 | gulp.task('default', ['config', 'generator', 'html']); 71 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "vdom-benchmark", 4 | "version": "0.1.0", 5 | "description": "Virtual DOM Benchmark", 6 | "license": "BSD", 7 | "homepage": "https://github.com/localvoid/vdom-benchmark", 8 | "repository": "https://github.com/localvoid/vdom-benchmark", 9 | "author": { 10 | "name": "Boris Kaul", 11 | "email": "localvoid@gmail.com", 12 | "url": "https://github.com/localvoid" 13 | }, 14 | "keywords": [ 15 | "virtual", 16 | "dom", 17 | "virtualdom", 18 | "vdom", 19 | "diff", 20 | "browser", 21 | "benchmark" 22 | ], 23 | "dependencies": { 24 | "vdom-benchmark-generator": "^0.1.0" 25 | }, 26 | "devDependencies": { 27 | "browser-sync": "^1.9.0", 28 | "browserify": "^8.1.1", 29 | "del": "^1.1.1", 30 | "gulp": "^3.8.10", 31 | "gulp-gh-pages": "^0.4.0", 32 | "gulp-if": "^1.2.5", 33 | "gulp-sourcemaps": "^1.3.0", 34 | "gulp-uglify": "^1.1.0", 35 | "vinyl-buffer": "^1.0.0", 36 | "vinyl-source-stream": "^1.0.0" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /web/config.js: -------------------------------------------------------------------------------- 1 | benchmarkConfig({ 2 | "name": "VDom Benchmark", 3 | "description": "Comparing performance of the diff/patch operations in various virtual dom libraries.", 4 | "data": { 5 | "type": "script", 6 | "url": "http://localvoid.github.io/vdom-benchmark/generator.js" 7 | }, 8 | "contestants": [ 9 | { 10 | "name": "kivi", 11 | "url": "https://github.com/localvoid/kivi", 12 | "benchmarkUrl": "http://localvoid.github.io/vdom-benchmark-kivi/" 13 | }, 14 | { 15 | "name": "cito.js", 16 | "url": "https://github.com/joelrich/citojs", 17 | "benchmarkUrl": "http://localvoid.github.io/vdom-benchmark-cito/" 18 | }, 19 | { 20 | "name": "Bobril", 21 | "url": "https://github.com/Bobris/Bobril", 22 | "benchmarkUrl": "http://localvoid.github.io/vdom-benchmark-bobril/" 23 | }, 24 | { 25 | "name": "React", 26 | "url": "http://facebook.github.io/react/", 27 | "benchmarkUrl": "http://localvoid.github.io/vdom-benchmark-react/" 28 | }, 29 | { 30 | "name": "virtual-dom", 31 | "url": "https://github.com/Matt-Esch/virtual-dom", 32 | "benchmarkUrl": "http://localvoid.github.io/vdom-benchmark-virtual-dom/" 33 | }, 34 | { 35 | "name": "mithril", 36 | "url": "http://lhorie.github.io/mithril/", 37 | "benchmarkUrl": "http://localvoid.github.io/vdom-benchmark-mithril/" 38 | } 39 | ] 40 | }); 41 | -------------------------------------------------------------------------------- /web/generator.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var generator = require('vdom-benchmark-generator'); 4 | var transformers = generator.transformers; 5 | var Generator = generator.Generator; 6 | 7 | var g = new Generator(); 8 | g.addGroup([500], [ 9 | [transformers.reverse], 10 | [transformers.shuffle], 11 | [transformers.insertFirst], 12 | [transformers.insertLast], 13 | [transformers.removeFirst], 14 | [transformers.removeLast], 15 | [transformers.moveFromEndToStart], 16 | [transformers.moveFromStartToEnd] 17 | ]); 18 | 19 | g.addGroup([50, 10], [ 20 | [transformers.reverse, transformers.skip], 21 | [transformers.shuffle, transformers.skip], 22 | [transformers.insertFirst, transformers.skip], 23 | [transformers.insertLast, transformers.skip], 24 | [transformers.removeFirst, transformers.skip], 25 | [transformers.removeLast, transformers.skip], 26 | [transformers.moveFromEndToStart, transformers.skip], 27 | [transformers.moveFromStartToEnd, transformers.skip] 28 | ]); 29 | 30 | g.addGroup([5, 100], [ 31 | [transformers.reverse, transformers.skip], 32 | [transformers.shuffle, transformers.skip], 33 | [transformers.insertFirst, transformers.skip], 34 | [transformers.insertLast, transformers.skip], 35 | [transformers.removeFirst, transformers.skip], 36 | [transformers.removeLast, transformers.skip], 37 | [transformers.moveFromEndToStart, transformers.skip], 38 | [transformers.moveFromStartToEnd, transformers.skip] 39 | ]); 40 | 41 | window.generateBenchmarkData = function(config) { 42 | return { 43 | units: g.generate() 44 | }; 45 | }; 46 | -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Virtual DOM Benchmark 7 | 8 | 9 | 10 |
11 |
12 |

Virtual DOM Benchmark

13 |

Comparing performance of the diff/patch operations in various virtual dom libraries.

14 |

Virtual DOM Benchmark is moved to the new location.

15 |
16 |
17 | 18 | 19 | 20 | --------------------------------------------------------------------------------