Created
January 19, 2017 01:21
-
-
Save chicoxyzzy/0ecb281f61120a4704d3313e4d600859 to your computer and use it in GitHub Desktop.
Benchmarking for loops
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Now using node v4.7.2 (npm v2.15.11) | |
// v8 4.5.103.43 (Node.js 4.7.2) | |
forVar_______: 2ms | |
forLet_______: 13ms | |
forOfVar_____: 66ms | |
forOfLetConst: 64ms | |
forEachVar___: 15ms | |
forEachLet___: 21ms | |
Now using node v6.9.4 (npm v3.10.10) | |
// v8 5.1.281.89 (Node.js 6.9.4) | |
forVar_______: 0.877ms | |
forLet_______: 4.903ms | |
forOfVar_____: 29.475ms | |
forOfLetConst: 30.805ms | |
forEachVar___: 13.374ms | |
forEachLet___: 13.863ms | |
Now using node v7.4.0 (npm v4.1.1) | |
// v8 5.4.500.45 (Node.js 7.4.0) | |
forVar_______: 1.021ms | |
forLet_______: 15.546ms | |
forOfVar_____: 15.307ms | |
forOfLetConst: 15.622ms | |
forEachVar___: 15.710ms | |
forEachLet___: 23.886ms | |
// v8 5.7.114 (Node.js 8.0.0-pre) | |
forVar_______: 0.984ms | |
forLet_______: 17.082ms | |
forOfVar_____: 2.610ms | |
forOfLetConst: 2.840ms | |
forEachVar___: 17.260ms | |
forEachLet___: 23.416ms |
Test | Node.js 4.7.2 LTS v8 4.5.103.43 |
Node.js 6.9.4 LTS v8 5.1.281.89 |
Node.js 7.4.0 Stable v8 5.4.500.45 |
Node.js 8.0.0-pre v8 5.7.114 |
---|---|---|---|---|
forVar | 2 ms | 0.877 ms | 1.021 ms | 0.984 ms |
forLet | 13 ms | 4.903 ms | 15.546 ms | 17.082 ms |
forOfVar | 66 ms | 29.475 ms | 15.307 ms | 2.610 ms |
forOfLetConst | 64 ms | 30.805 ms | 15.622 ms | 2.840 ms |
forEachVar | 15 ms | 13.374 ms | 15.710 ms | 17.260 ms |
forEachLet | 21 ms | 13.863 ms | 23.886 ms | 23.416 ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
based on @vsemozhetbyt's tests from
https://gist.github.com/vsemozhetbyt/396eb4b7713accf60ead2fe164e47306