简体   繁体   English

Node.js中的“CrankShaftScript”是什么?

[英]What is “CrankShaftScript” in Node.js?

There are more and more references in the Node.js community to "CrankShaftScript" (and "CrankShaftJS") on Twitter, GitHub, and Facebook group discussions. Node.js社区中有越来越多的关于Twitter,GitHub和Facebook小组讨论的“CrankShaftScript”(和“CrankShaftJS”)的引用。 I thought Node.js was written in C++ and JavaScript, so what is CrankShaftScript referring to in performance regression bugs like this one: 我认为Node.js是用C ++和JavaScript编写的,所以CrankShaftScript在性能回归中指的是这样的错误:

https://github.com/nodejs/CTC/issues/146#issue-237435588 https://github.com/nodejs/CTC/issues/146#issue-237435588

CrankShaftScript is the name given by the community to JS idioms (such as certain types of loops) that run faster(est?) on V8's CrankShaft engine. CrankShaftScript是社区给出的JS惯用语(例如某些类型的循环)在V8的CrankShaft引擎上运行得更快(est?)的名称。

CrankShaft is being replaced by an engine named TurboFan. CrankShaft正在被名为TurboFan的发动机取代。 Lots of JS code written by devs over the years has been written specifically to run fast on CrankShaft (eg written in "CrankShaftScript") using the known idioms that run fast on CrankShaft - this is no longer necessarily the case because the V8 engine is now different and the code that ran fastest on CrankShaft is not necessarily guaranteed to run fastest on TurboFan. 开发人员多年来编写的大量JS代码专门用于在CrankShaft上快速运行(例如用“CrankShaftScript”编写),使用在CrankShaft上快速运行的已知惯用语 - 由于V8引擎现在已经不再适用了不同,在CrankShaft上运行速度最快的代码不一定能保证在TurboFan上运行得最快。

In case my answer is too verbose, here's a great comment on the NodeJS Benchmarks thread that may detail it better: 如果我的答案过于冗长,那么对NodeJS基准测试线程的评论可能会更好:

...I noticed that some parts of Node core are sort-of written in CrankshaftScript, ie carefully tuned towards stuff that works extremely well in Crankshaft. ......我注意到Node核心的某些部分是用CrankshaftScript编写的,即仔细调整到在Crankshaft中运行得非常好的东西。

CrankShaftScript is a community-adopted term used for non-idiomatic and/or non-standard compliant JavaScript that will only execute and/or perform well in the specific versions of the v8 JavaScript runtime that employ the CrankShaft JIT compiler. CrankShaftScript是一个社区采用的术语,用于非惯用和/或非标准兼容的JavaScript,只能在使用CrankShaft JIT编译器的v8 JavaScript运行时的特定版本中执行和/或执行。 Specific examples include: loops written in a difficult-to-maintain fashion to work around JIT optimization deficiencies in v8, and use of v8-specific built-in functions/globals. 具体示例包括:以难以维护的方式编写的循环,以解决v8中的JIT优化缺陷,以及使用特定于v8的内置函数/全局变量。

This term was originally coined to describe some root performance issues in node-chakracore and spidernode, which are Node.js distributions that employ the ChakraCore and SpiderMonkey runtimes instead of v8. 这个术语最初用于描述node-chakracore和spidernode中的一些根性能问题,它们是使用ChakraCore和SpiderMonkey运行时而不是v8的Node.js发行版。

It is now being used as shorthand to explain why the Node.js 8.1 release series, which updated to a newer version of v8, has several performance regressions in micro- and macro-benchmarks due to v8's CrankShaft JIT being superseded by TurboFan (sometimes referred to as "TF"). 它现在被用作速记来解释为什么Node.js 8.1发布系列更新到更新版本的v8,由于v8的CrankShaft JIT被TurboFan取代而在微观和宏观基准测试中有几个性能回归(有时会被引用)作为“TF”)。 As in these issues: 正如在这些问题中:

For these reasons, the Node.js community is actively working on excising instances of CrankShaftScript in Node.js core code, as well as in common npm packages. 出于这些原因,Node.js社区正在积极地在Node.js核心代码以及常见的npm包中切除CrankShaftScript的实例。 This should help alternative Node.js distributions like node-chakracore perform better and ease the risk of future upgrades to the JavaScript runtime in Node.js. 这应该有助于像node-chakracore这样的替代Node.js发行版能够更好地运行并减轻将来升级到Node.js中JavaScript运行时的风险。

CrankShaft is the compilation infrastructure for V8, Node.js' Javascript runtime ( details ). CrankShaft是V8的编译基础结构,Node.js的Javascript运行时( 详细信息 )。

It's now being replaced by TurboFan . 现在被TurboFan取代

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM