摘要:前言项目地址如果有想要增加的特性,欢迎更新,然后。环境大致结论许多情况下下的特性表现相对更好。
前言
项目 github 地址:https://github.com/DavidCai1993/ES6-benchmark
如果有想要增加的特性 benchmark ,欢迎更新benchmarks/ ,然后 PR 。
环境CPU: Intel Core(TM) i5-2410M 2.30GHz
Memory: 8GB 1600 MHz DDR3
Node.js: 5.9.0 / Node-chakracore 6.0.0-pre5
大致结论许多情况下: V8 ES5 >> Chakra ES6 > Chakra ES5 > V8 ES6
Chakra 下的 ES6 特性表现相对更好。
Benchmarkconcat-strings.js
</>复制代码
V8:
template string vs use +
14,643,602 op/s » ${a}${b}
96,959,110 op/s » a + b
Chakra:
template string vs use +
35,756,501 op/s » ${a}${b}
19,995,366 op/s » a + b
for-of-for-loop.js
</>复制代码
V8:
for...of vs for loop
851,761 op/s » for...of
12,507,823 op/s » for loop, i < arr.length
Chakra:
for...of vs for loop
1,133,193 op/s » for...of
16,715,320 op/s » for loop, i < arr.length
merge-objects.js
</>复制代码
V8:
merge objects
669,921 op/s » Object.assign
23,625,182 op/s » for...in loop and assign
Chakra:
merge objects
3,102,889 op/s » Object.assign
3,744,837 op/s » for...in loop and assign
declear-class.js
</>复制代码
V8:
declear a class
118,864 op/s » Class
153,662 op/s » use function and prototype
Chakra:
declear a class
560,705 op/s » Class
701,991 op/s » use function and prototype
repeat-string.js
</>复制代码
V8:
string.repeat() vs use +
8,828,842 op/s » string.repeat()
107,824,137 op/s » use +
Chakra:
string.repeat() vs use +
13,022,259 op/s » string.repeat()
3,328,631 op/s » use +
array-like-to-array.js
</>复制代码
V8:
array like object to array
1,302,649 op/s » Array.from
540,458 op/s » Array.prototype.slice.call
Chakra:
array like object to array
1,864,649 op/s » Array.from
2,537,458 op/s » Array.prototype.slice.call
promise-bluebird.js
</>复制代码
promise vs bluebird
V8:
322,534 op/s » promise
1,763,186 op/s » bluebird
Chakra:
69,534 op/s » promise
178,186 op/s » bluebird
var-let-const.js
</>复制代码
V8:
var let const
134,028,614 op/s » let
129,193,000 op/s » const
431,460,321 op/s » var
Chakra:
var let const
156,028,614 op/s » let
170,193,000 op/s » const
150,460,321 op/s » var
string-start-with.js
</>复制代码
V8:
string starts with
9,774,987 op/s » string.startsWith(value)
74,127,611 op/s » string[0] === value
Chakra:
string starts with
26,774,987 op/s » string.startsWith(value)
47,127,611 op/s » string[0] === value
define-a-funciton-with-this.js
</>复制代码
V8:
define a function with inherited this
59,661,143 op/s » () =>
64,874,220 op/s » function statement
Chakra:
define a function with inherited this
69,661,143 op/s » () =>
69,874,220 op/s » function statement
parse-int.js
</>复制代码
V8:
global.parseInt() vs Number.parseInt()
53,940,634 op/s » Number.parseInt()
81,509,873 op/s » global.parseInt()
Chakra:
global.parseInt() vs Number.parseInt()
16,940,634 op/s » Number.parseInt()
19,509,873 op/s » global.parseInt()
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/78967.html
摘要:作者源地址最近一个事件搞得圈沸沸扬扬的我们暂且把这个事情放一边来看看本身的实现的源码如下这段程序的作用是给一个字符串或可以转成的变量用字符在左边补位将其补到长度为当然这个程序没做充足的参数检查这个就不细说了我们分析一下它的效率如果 作者: @flowmemo源地址: http://flowmemo.github.io/2016/03/25/str... 最近一个left-pad事件搞得...
摘要:前端每周清单专注前端领域内容,以对外文资料的搜集为主,帮助开发者了解一周前端热点分为新闻热点开发教程工程实践深度阅读开源项目巅峰人生等栏目。背后的故事本文是对于年之间世界发生的大事件的详细介绍,阐述了从提出到角力到流产的前世今生。 前端每周清单专注前端领域内容,以对外文资料的搜集为主,帮助开发者了解一周前端热点;分为新闻热点、开发教程、工程实践、深度阅读、开源项目、巅峰人生等栏目。欢迎...
摘要:本章将会深入谷歌引擎的内部结构。一个引擎可以用标准解释程序或者即时编译器来实现,即时编译器即以某种形式把解释为字节码。引擎的由来引擎是由谷歌开源并以语言编写。注意到没有使用中间字节码来表示,这样就不需要解释器了。 原文请查阅这里,略有删减。 本系列持续更新中,Github 地址请查阅这里。 这是 JavaScript 工作原理的第二章。 本章将会深入谷歌 V8 引擎的内部结构。我们也会...
摘要:摘要性能彪悍的引擎。深入浅出系列深入浅出第课箭头函数中的究竟是什么鬼深入浅出第课函数是一等公民是什么意思呢深入浅出第课什么是垃圾回收算法深入浅出第课是如何工作的最近,生态系统又多了个非常硬核的项目。 摘要: 性能彪悍的V8引擎。 《JavaScript深入浅出》系列: JavaScript深入浅出第1课:箭头函数中的this究竟是什么鬼? JavaScript深入浅出第2课:函数是一...
摘要:引擎可以是一个标准的解释器,也可以是一个将编译成某种形式的字节码的即时编译器。和其他引擎最主要的差别在于,不会生成任何字节码或是中间代码。不使用中间字节码的表示方式,就没有必要用解释器了。 原文地址:https://blog.sessionstack.com... showImg(https://segmentfault.com/img/bVVwZ8?w=395&h=395); 数周之...
阅读 1523·2021-09-03 10:29
阅读 3537·2019-08-29 16:24
阅读 2248·2019-08-29 11:03
阅读 1518·2019-08-26 13:52
阅读 3019·2019-08-26 11:36
阅读 2880·2019-08-23 17:19
阅读 625·2019-08-23 17:14
阅读 882·2019-08-23 13:59