├── .editorconfig ├── .gitignore ├── .npmignore ├── .travis.yml ├── LICENSE.md ├── README.md ├── bench.js ├── features ├── array-iterate │ ├── babel-loose.js │ ├── babel.js │ ├── eachr.js │ ├── es5-for.js │ ├── es5-foreach.js │ └── es6-forof.js ├── arrows │ ├── coffee-fat.js │ ├── coffee-skinny.js │ ├── es5-bind.js │ ├── es5-function.js │ └── es6-fat.js ├── classes │ ├── coffee-class.js │ └── es6-class.js ├── map-instantiate │ ├── coffee-object.js │ ├── es5-object.js │ └── es6-map.js ├── map-iterate │ ├── coffee-own.js │ ├── es5-getown.js │ ├── es5-keys.js │ ├── es5-own.js │ └── es6-map.js ├── rest-parameters │ ├── coffee-splat.js │ ├── es5-optimised.js │ ├── es5-slice.js │ └── es6-splat.js ├── static-classes │ ├── babel-static-class.js │ ├── es5-static-class.js │ └── es6-static-class.js ├── var-access │ ├── es5-var.js │ ├── es6-const.js │ └── es6-let.js └── var-assign │ ├── es5-var.js │ ├── es6-const.js │ └── es6-let.js └── package.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # v1.3.18 June 8, 2014 2 | # https://github.com/bevry/base 3 | root = true 4 | 5 | [*] 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = false 9 | insert_final_newline = false 10 | indent_style = tab 11 | 12 | [*.json] 13 | indent_style = space 14 | indent_size = 2 15 | 16 | [*.yml] 17 | indent_style = space 18 | indent_size = 2 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # March 15, 2015 2 | # https://github.com/bevry/base 3 | 4 | # Temp Files 5 | **/*.log 6 | **/.docpad.db 7 | 8 | # Build Files 9 | build/ 10 | components/ 11 | bower_components/ 12 | node_modules/ 13 | out/ 14 | 15 | # Editor Caches 16 | .c9/ 17 | 18 | # Private Files 19 | .env 20 | .idea 21 | .cake_task_cache 22 | 23 | 24 | # ===================================== 25 | # CUSTOM MODIFICATIONS 26 | 27 | # None 28 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # v1.3.23 October 11, 2014 2 | # https://github.com/bevry/base 3 | 4 | # Temp Files 5 | **/*.log 6 | **/.docpad.db 7 | 8 | # Build Files 9 | build/ 10 | components/ 11 | bower_components/ 12 | node_modules/ 13 | 14 | # Private Files 15 | .env 16 | 17 | # Development Files 18 | .editorconfig 19 | .eslintrc 20 | .jshintrc 21 | coffeelint.json 22 | .travis* 23 | Cakefile 24 | Makefile 25 | BACKERS.md 26 | CONTRIBUTING.md 27 | HISTORY.md 28 | **/src/ 29 | **/test/ 30 | 31 | # Other Package Definitions 32 | template.js 33 | component.json 34 | bower.json 35 | 36 | # ===================================== 37 | # CUSTOM MODIFICATIONS 38 | 39 | # None 40 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # 2016 April 27 2 | # https://github.com/bevry/base 3 | 4 | # Use the latest travis infrastructure 5 | sudo: false 6 | 7 | # We use node 8 | language: node_js 9 | node_js: 10 | - "0.12" 11 | - "4" 12 | - "6" 13 | - "8" 14 | - "9" 15 | cache: 16 | directories: 17 | - node_modules 18 | 19 | # Run our tests 20 | script: "npm test" 21 | 22 | # Custom notifications 23 | notifications: 24 | slack: 25 | secure: ZxJoY5y32erE8HM2/iTtyLCLH21ef1yVNsHDkO4OJej0DpTtiVDrvPWIwxSrbHBrfE38gSGAAqC5aUfOQ+ZV3KEPRXNcigprov9/0LqJTuIN/wkavtf7P6ANkg7LvrZ/y+YQQpEV9/1M9l+4cgh0lYCq+wQes1U+3ocqTZEB5Dc= 26 | email: 27 | recipients: 28 | secure: IUUxjLorhzioB/EMF2jThVJkAvb/RghKt0zFzDavaidI4Uh/SMSC73zEbRxdsvPl6/FaiXD9ONiEEZLmmu5VqnGzx+sGqBBQ77+nvbKoSF7KVHgWhnzWr5agsgaoYF9TLX7HO0CkCX5p2fOnU4Z6HWGRPPmu3lFcTDiNbQ4DloA= 29 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 |

License

4 | 5 | Unless stated otherwise all works are: 6 | 7 | 8 | 9 | and licensed under: 10 | 11 | 12 | 13 |

MIT License

14 | 15 |
16 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
17 | 
18 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
19 | 
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | 
22 | 23 | 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 |

ESNext Benchmarks

4 | 5 | 6 | 7 | 8 | 9 | 10 | Travis CI Build Status 11 |
12 | Slack community badge 13 | Patreon donate button 14 | Gratipay donate button 15 | Flattr donate button 16 | PayPal donate button 17 | Bitcoin donate button 18 | Wishlist browse button 19 | 20 | 21 | 22 | 23 | 24 | 25 | Benchmarks comparing ESNext features to their ES5 and various pre-processor equivalents 26 | 27 | 28 | 29 | 30 | ## Usage 31 | 32 | 1. Install [NVM](https://github.com/creationix/nvm) 33 | 1. Install [node.js](https://nodejs.org): `nvm install node` 34 | 1. Clone this repo: `git clone https://github.com/bevry/esnext-benchmarks.git esnext-benchmarks` 35 | 1. Change into the cloned directory: `cd esnext-benchmarks` 36 | 1. Install dependencies: `npm install` 37 | 1. Run the benchmarks: `npm test` 38 | 39 | ## Latest Benchmark Results 40 | [See what Travis CI says.](https://travis-ci.org/bevry/esnext-benchmarks) 41 | 42 | ## ESNext Features 43 | [Check out this listing to learn more about ESNext.](https://babeljs.io/docs/learn-es2015/) 44 | 45 | ## History 46 | [Discover the change history via the git changelog.](https://github.com/bevry/esnext-benchmarks/commits/master) 47 | 48 | 49 | 50 | 51 |

Backers

52 | 53 |

Maintainers

54 | 55 | These amazing people are maintaining this project: 56 | 57 | 58 | 59 |

Sponsors

60 | 61 | No sponsors yet! Will you be the first? 62 | 63 | Patreon donate button 64 | Gratipay donate button 65 | Flattr donate button 66 | PayPal donate button 67 | Bitcoin donate button 68 | Wishlist browse button 69 | 70 |

Contributors

71 | 72 | These amazing people have contributed code to this project: 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 |

License

84 | 85 | Unless stated otherwise all works are: 86 | 87 | 88 | 89 | and licensed under: 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /bench.js: -------------------------------------------------------------------------------- 1 | // Imports 2 | var joe = require('joe') 3 | var microtime = require('microtime-nodejs') 4 | var pathUtil = require('path') 5 | var scandir = require('scandirectory') 6 | var featuresPath = __dirname+'/features' 7 | var Table = require('cli-table') 8 | 9 | // Tests 10 | joe.suite('esnext-benchmarks', function (suite, test, done) { 11 | scandir({ 12 | path: featuresPath, 13 | recurse: true, 14 | next: function (err, list, features) { 15 | Object.keys(features).forEach(function (featureName) { 16 | // Create the benchmarks suite for the featureName 17 | suite(featureName, function (suite, test) { 18 | var reports = [] 19 | var totalDuration = 0 20 | var totalIterations = 0 21 | // Add the tests for the featureName 22 | Object.keys(features[featureName]).forEach(function (testFile) { 23 | var path = pathUtil.join(featuresPath, featureName, testFile) 24 | var testName = testFile.split('.')[0] 25 | test(testName, function(){ 26 | var m = null 27 | 28 | try { 29 | m = require(path) 30 | } catch ( err ) { 31 | console.error('The test ['+testName+'] will be ignored because it failed to load:', err.message) 32 | return 33 | } 34 | 35 | try { 36 | var start = microtime.nowDouble() 37 | var end = microtime.nowDouble() + 1.00 38 | var iterations = 0 39 | while ( microtime.nowDouble() < end ) { 40 | m(1, "two", {}, 4, "five") 41 | iterations++ 42 | } 43 | end = microtime.nowDouble() 44 | 45 | } catch ( err ) { 46 | console.error('The test ['+testName+'] will be ignored because it failed to run:', err.message) 47 | return 48 | } 49 | 50 | var duration = end - start 51 | reports.push({ 52 | feature: featureName, 53 | test: testName, 54 | iterations: iterations, 55 | duration: duration 56 | }) 57 | totalIterations += iterations 58 | totalDuration += duration 59 | }) 60 | }) 61 | test('report', function(){ 62 | var table = new Table({ 63 | head: ['test', 'iterations', 'iterations percent', 'iterations percent increase', 'time per iteration', 'faster than next by', 'faster than last by', 'time'] 64 | }) 65 | reports = reports.sort(function(a,b){ 66 | return a.iterations < b.iterations 67 | }) 68 | var names = [] 69 | reports.forEach(function(report, index){ 70 | names.push(report.test) 71 | report.iterationsPercent = Math.round( 72 | (report.iterations / totalIterations)*100 73 | ) 74 | report.timePerIteration = 75 | report.duration / report.iterations 76 | 77 | // Compare with previous report 78 | if ( index === reports.length - 1 ) { 79 | report.fasterNextPercent = '' 80 | } else { 81 | report.fasterNextPercent = Math.round( 82 | (report.iterations / reports[index+1].iterations)*100 - 100 83 | ) 84 | } 85 | 86 | // Compare with last report 87 | if ( index === reports.length - 1 ) { 88 | report.fasterLastPercent = '' 89 | } else { 90 | report.fasterLastPercent = Math.round( 91 | (report.iterations / reports[reports.length-1].iterations)*100 - 100 92 | ) 93 | } 94 | 95 | }) 96 | reports.forEach(function(report, index){ 97 | // Compare with previous report 98 | if ( index === reports.length - 1 ) { 99 | report.iterationsPercentIncrease = '' 100 | } else { 101 | report.iterationsPercentIncrease = report.iterationsPercent - reports[index+1].iterationsPercent + '%' 102 | } 103 | if ( typeof report.iterationsPercent === 'number' ) { 104 | report.iterationsPercent += '%' 105 | } 106 | if ( typeof report.fasterNextPercent === 'number' ) { 107 | report.fasterNextPercent += '%' 108 | } 109 | if ( typeof report.fasterLastPercent === 'number' ) { 110 | report.fasterLastPercent += '%' 111 | } 112 | 113 | table.push([ 114 | report.test, 115 | report.iterations, 116 | report.iterationsPercent, 117 | report.iterationsPercentIncrease, 118 | report.timePerIteration, 119 | report.fasterNextPercent, 120 | report.fasterLastPercent, 121 | report.duration 122 | ]) 123 | }) 124 | console.log('') 125 | console.info('Results of the ['+featureName+'] feature (the more iterations the better):') 126 | console.log(table.toString()) 127 | console.info('Fastest to slowest: ['+names.join('], [')+']') 128 | console.log('') 129 | }) 130 | }) 131 | }) 132 | done() 133 | } 134 | }) 135 | 136 | }) 137 | -------------------------------------------------------------------------------- /features/array-iterate/babel-loose.js: -------------------------------------------------------------------------------- 1 | // imports es6-forof.js 2 | 'use strict'; 3 | 4 | var items = ['a', 'b', 'c', 'd', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'y', 'x', 'z']; 5 | module.exports = function () { 6 | var result = []; 7 | for (var _iterator = items, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { 8 | var _ref; 9 | 10 | if (_isArray) { 11 | if (_i >= _iterator.length) break; 12 | _ref = _iterator[_i++]; 13 | } else { 14 | _i = _iterator.next(); 15 | if (_i.done) break; 16 | _ref = _i.value; 17 | } 18 | 19 | var item = _ref; 20 | 21 | result.push(item); 22 | } 23 | return; 24 | }; 25 | -------------------------------------------------------------------------------- /features/array-iterate/babel.js: -------------------------------------------------------------------------------- 1 | // imports es6-forof.js 2 | 'use strict'; 3 | 4 | var items = ['a', 'b', 'c', 'd', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'y', 'x', 'z']; 5 | module.exports = function () { 6 | var result = []; 7 | var _iteratorNormalCompletion = true; 8 | var _didIteratorError = false; 9 | var _iteratorError = undefined; 10 | 11 | try { 12 | for (var _iterator = items[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { 13 | var item = _step.value; 14 | 15 | result.push(item); 16 | } 17 | } catch (err) { 18 | _didIteratorError = true; 19 | _iteratorError = err; 20 | } finally { 21 | try { 22 | if (!_iteratorNormalCompletion && _iterator.return) { 23 | _iterator.return(); 24 | } 25 | } finally { 26 | if (_didIteratorError) { 27 | throw _iteratorError; 28 | } 29 | } 30 | } 31 | 32 | return; 33 | }; 34 | -------------------------------------------------------------------------------- /features/array-iterate/eachr.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | var eachr = require('eachr') 3 | var items = ['a', 'b', 'c', 'd', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'y', 'x', 'z'] 4 | module.exports = function () { 5 | var result = [] 6 | eachr(items, function (item) { 7 | result.push(item) 8 | }) 9 | return 10 | } 11 | -------------------------------------------------------------------------------- /features/array-iterate/es5-for.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | var items = ['a', 'b', 'c', 'd', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'y', 'x', 'z'] 3 | module.exports = function () { 4 | var result = [] 5 | for ( var i = 0; i < items.length; ++i ) { 6 | var item = items[i] 7 | result.push(item) 8 | } 9 | return 10 | } 11 | -------------------------------------------------------------------------------- /features/array-iterate/es5-foreach.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | var items = ['a', 'b', 'c', 'd', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'y', 'x', 'z'] 3 | module.exports = function () { 4 | var result = [] 5 | items.forEach(function (item) { 6 | result.push(item) 7 | }) 8 | return 9 | } 10 | -------------------------------------------------------------------------------- /features/array-iterate/es6-forof.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | var items = ['a', 'b', 'c', 'd', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'y', 'x', 'z'] 3 | module.exports = function () { 4 | var result = [] 5 | for ( var item of items ) { 6 | result.push(item) 7 | } 8 | return 9 | } 10 | -------------------------------------------------------------------------------- /features/arrows/coffee-fat.js: -------------------------------------------------------------------------------- 1 | /* 2 | module.exports = -> 3 | (=>)() 4 | return 5 | */ 6 | // compiled with coffeescript 1.10.0 7 | module.exports = function() { 8 | ((function(_this) { 9 | return function() {}; 10 | })(this))(); 11 | }; 12 | -------------------------------------------------------------------------------- /features/arrows/coffee-skinny.js: -------------------------------------------------------------------------------- 1 | /* 2 | module.exports = -> 3 | (->)() 4 | return 5 | */ 6 | // compiled with coffeescript 1.10.0 7 | module.exports = function() { 8 | (function() {})(); 9 | }; 10 | -------------------------------------------------------------------------------- /features/arrows/es5-bind.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = function () { 3 | (function () {}).bind(this)() 4 | return 5 | } 6 | -------------------------------------------------------------------------------- /features/arrows/es5-function.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = function () { 3 | (function () {})() 4 | return 5 | } 6 | -------------------------------------------------------------------------------- /features/arrows/es6-fat.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = function () { 3 | (() => {})() 4 | return 5 | } 6 | -------------------------------------------------------------------------------- /features/classes/coffee-class.js: -------------------------------------------------------------------------------- 1 | /* 2 | module.exports = -> 3 | class A 4 | class B extends A 5 | return 6 | */ 7 | // compiled with coffeescript 1.10.0 8 | var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, 9 | hasProp = {}.hasOwnProperty; 10 | 11 | module.exports = function() { 12 | var A, B; 13 | A = (function() { 14 | function A() {} 15 | 16 | return A; 17 | 18 | })(); 19 | B = (function(superClass) { 20 | extend(B, superClass); 21 | 22 | function B() { 23 | return B.__super__.constructor.apply(this, arguments); 24 | } 25 | 26 | return B; 27 | 28 | })(A); 29 | }; 30 | -------------------------------------------------------------------------------- /features/classes/es6-class.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = function () { 3 | class A {} 4 | class B extends A {} 5 | return 6 | } 7 | -------------------------------------------------------------------------------- /features/map-instantiate/coffee-object.js: -------------------------------------------------------------------------------- 1 | /* 2 | module.exports = -> 3 | data = {name:'ben', company:'bevry'} 4 | return 5 | */ 6 | // compiled with coffeescript 1.10.0 7 | module.exports = function () { 8 | var data; 9 | data = { 10 | name: 'ben', 11 | company: 'bevry' 12 | }; 13 | }; 14 | -------------------------------------------------------------------------------- /features/map-instantiate/es5-object.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = function () { 3 | var data = {name:'ben', company:'bevry'} 4 | return 5 | } 6 | -------------------------------------------------------------------------------- /features/map-instantiate/es6-map.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = function () { 3 | let data = new Map().set('name', 'ben').set('company', 'bevry') 4 | return 5 | } 6 | -------------------------------------------------------------------------------- /features/map-iterate/coffee-own.js: -------------------------------------------------------------------------------- 1 | /* 2 | data = {name:'ben', company:'bevry'} 3 | module.exports = -> 4 | result = [] 5 | for own key, value of data 6 | result.push(key+': '+value) 7 | return 8 | */ 9 | // compiled with coffeescript 1.10.0 10 | var data, 11 | hasProp = {}.hasOwnProperty; 12 | 13 | data = { 14 | name: 'ben', 15 | company: 'bevry' 16 | }; 17 | 18 | module.exports = function() { 19 | var key, result, value; 20 | result = []; 21 | for (key in data) { 22 | if (!hasProp.call(data, key)) continue; 23 | value = data[key]; 24 | result.push(key + ': ' + value); 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /features/map-iterate/es5-getown.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | var data = {name:'ben', company:'bevry'} 3 | module.exports = function () { 4 | var result = [] 5 | Object.getOwnPropertyNames(data).forEach(function (key) { 6 | var value = data[key] 7 | result.push(key + ': ' + value) 8 | }) 9 | return 10 | } 11 | -------------------------------------------------------------------------------- /features/map-iterate/es5-keys.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | var data = {name:'ben', company:'bevry'} 3 | module.exports = function () { 4 | var result = [] 5 | Object.keys(data).forEach(function (key) { 6 | var value = data[key] 7 | result.push(key + ': ' + value) 8 | }) 9 | return 10 | } 11 | -------------------------------------------------------------------------------- /features/map-iterate/es5-own.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | var data = {name:'ben', company:'bevry'} 3 | module.exports = function () { 4 | var result = [] 5 | for ( var key in data ) { 6 | if ( !data.hasOwnProperty(key) ) continue; 7 | var value = data[key] 8 | result.push(key + ': ' + value) 9 | } 10 | return 11 | } 12 | -------------------------------------------------------------------------------- /features/map-iterate/es6-map.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | let data = new Map().set('name', 'ben').set('company', 'bevry') 3 | module.exports = function () { 4 | var result = [] 5 | data.forEach(function (value, key) { 6 | result.push(key + ': ' + value) 7 | }) 8 | return 9 | } 10 | -------------------------------------------------------------------------------- /features/rest-parameters/coffee-splat.js: -------------------------------------------------------------------------------- 1 | /* 2 | module.exports = (args...) -> 3 | return 4 | */ 5 | // compiled with coffeescript 1.10.0 6 | var slice = [].slice; 7 | module.exports = function() { 8 | var args; 9 | args = 1 <= arguments.length ? slice.call(arguments, 0) : []; 10 | }; 11 | -------------------------------------------------------------------------------- /features/rest-parameters/es5-optimised.js: -------------------------------------------------------------------------------- 1 | // https://github.com/jashkenas/coffeescript/issues/3274 2 | 'use strict' 3 | module.exports = function () { 4 | var args = new Array(arguments.length); 5 | for (var i = 0; i< arguments.length; i++) { 6 | args[i] = arguments[i]; 7 | } 8 | return null 9 | } 10 | -------------------------------------------------------------------------------- /features/rest-parameters/es5-slice.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = function () { 3 | var args = Array.prototype.slice.call(arguments) 4 | return 5 | } 6 | -------------------------------------------------------------------------------- /features/rest-parameters/es6-splat.js: -------------------------------------------------------------------------------- 1 | // --harmony-rest-parameters (iojs does not yet support this) 2 | // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters 3 | // https://code.google.com/p/v8/issues/detail?id=2159 4 | // https://groups.google.com/forum/embed/?place=forum/strengthen-js#!topic/strengthen-js/2lW_VzHBfKw 5 | 'use strict' 6 | module.exports = function (...args) { 7 | return 8 | } 9 | -------------------------------------------------------------------------------- /features/static-classes/babel-static-class.js: -------------------------------------------------------------------------------- 1 | // imports es6-static-class.js 2 | 3 | 'use strict'; 4 | 5 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 6 | 7 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8 | 9 | module.exports = function () { 10 | var A = function () { 11 | function A() { 12 | _classCallCheck(this, A); 13 | } 14 | 15 | _createClass(A, null, [{ 16 | key: 'a', 17 | value: function a() {} 18 | }, { 19 | key: 'b', 20 | value: function b() {} 21 | }, { 22 | key: 'c', 23 | value: function c() {} 24 | }]); 25 | 26 | return A; 27 | }(); 28 | 29 | return; 30 | }; 31 | -------------------------------------------------------------------------------- /features/static-classes/es5-static-class.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = function () { 3 | var A = { 4 | a: function () {}, 5 | b: function () {}, 6 | c: function () {} 7 | } 8 | return 9 | } 10 | -------------------------------------------------------------------------------- /features/static-classes/es6-static-class.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = function () { 3 | class A { 4 | static a () {} 5 | static b () {} 6 | static c () {} 7 | } 8 | return 9 | } 10 | -------------------------------------------------------------------------------- /features/var-access/es5-var.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | var blah = 5 3 | module.exports = function () { 4 | blah * blah * blah 5 | return 6 | } 7 | -------------------------------------------------------------------------------- /features/var-access/es6-const.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const blah = 5 3 | module.exports = function () { 4 | blah * blah * blah 5 | return 6 | } 7 | -------------------------------------------------------------------------------- /features/var-access/es6-let.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | let blah = 5 3 | module.exports = function () { 4 | blah * blah * blah 5 | return 6 | } 7 | -------------------------------------------------------------------------------- /features/var-assign/es5-var.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = function () { 3 | var blah = 5 4 | return 5 | } 6 | -------------------------------------------------------------------------------- /features/var-assign/es6-const.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = function () { 3 | const blah = 5 4 | return 5 | } 6 | -------------------------------------------------------------------------------- /features/var-assign/es6-let.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = function () { 3 | let blah = 5 4 | return 5 | } 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "ESNext Benchmarks", 3 | "name": "esnext-benchmarks", 4 | "private": true, 5 | "version": "1.0.0", 6 | "description": "Benchmarks comparing ESNext features to their ES5 and various pre-processor equivalents", 7 | "homepage": "https://github.com/bevry/esnext-benchmarks", 8 | "license": "MIT", 9 | "keywords": [], 10 | "badges": { 11 | "list": [ 12 | "travisci", 13 | "---", 14 | "slackin", 15 | "patreon", 16 | "gratipay", 17 | "flattr", 18 | "paypal", 19 | "bitcoin", 20 | "wishlist" 21 | ], 22 | "config": { 23 | "patreonUsername": "bevry", 24 | "gratipayUsername": "bevry", 25 | "flattrUsername": "balupton", 26 | "paypalURL": "https://bevry.me/paypal", 27 | "bitcoinURL": "https://bevry.me/bitcoin", 28 | "wishlistURL": "https://bevry.me/wishlist", 29 | "slackinURL": "https://slack.bevry.me" 30 | } 31 | }, 32 | "author": "2015+ Bevry Pty Ltd (http://bevry.me)", 33 | "maintainers": [ 34 | "Benjamin Lupton (http://balupton.com)" 35 | ], 36 | "contributors": [ 37 | "Benjamin Lupton (http://balupton.com)" 38 | ], 39 | "bugs": { 40 | "url": "https://github.com/bevry/esnext-benchmarks/issues" 41 | }, 42 | "repository": { 43 | "type": "git", 44 | "url": "http://github.com/bevry/esnext-benchmarks.git" 45 | }, 46 | "engines": { 47 | "node": ">=5" 48 | }, 49 | "dependencies": { 50 | "cli-table": "^0.3.1", 51 | "eachr": "^3.2.0", 52 | "joe": "^1.8.0", 53 | "joe-reporter-console": "^1.2.1", 54 | "microtime-nodejs": "^1.0.0", 55 | "scandirectory": "^2.5.0" 56 | }, 57 | "devDependencies": { 58 | "projectz": "^1.1.6" 59 | }, 60 | "scripts": { 61 | "prepare": "node ./node_modules/.bin/projectz compile", 62 | "test": "node --harmony bench.js" 63 | } 64 | } 65 | --------------------------------------------------------------------------------