node.js 会编译 JavaScript 吗? [英] Does node.js compile JavaScript?

查看:36
本文介绍了node.js 会编译 JavaScript 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Node.js 使用 V8,它编译 JavaScript 作为优化策略.

Node.js uses V8 and it compiles the JavaScript as an optimization strategy.

那么,服务器端通过 node.js/V8 运行的 JavaScript 是编译还是解释?

So, the JavaScript running at the server side via node.js / V8 is compiled or interpreted?

推荐答案

解释器:语言运行时/虚拟机的(核心)模块部分,它针对一组用其虚拟机的语言表达的表达式采取特定动作"模块是.

Interpreter: A (core) module part of the language runtime / virtual machine which takes specific 'actions' against a set of expressions expressed in the language whose virtual machine the module is.

编译器:语言运行时的(核心)模块部分,它将以模块所在的编译器的语言表达的一组表达式转换"为一组对运行表达式的架构本机的指令.

Compiler: A (core) module part of the language runtime which 'converts' a set of expressions expressed in the language whose compiler the module is, into a set of instructions native to the architecture where the expressions are run against.

标准 Node.js 是针对 V8 构建的,它将每个 Javascript 代码片段编译为原生指令.您可以在命令行中使用 --print_code 标志来查看哪些脚本正在被编译,以及编译成什么.

Standard Node.js is built against V8, which compiles every Javascript code snippet into native instructions. You may use --print_code flag in the command line to see which scripts are getting compiled, and compiled into what.

希望这会有所帮助.

这篇关于node.js 会编译 JavaScript 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆