Node.js Manual & Documentation目前比较繁杂,主要包括下述几 个主要类库: V8 JavaScript, a C++ library. Used for interfacing with JavaScript: creating objects, calling functions, etc. Documented mostly in the v8.h header file (deps/v8/include/v8.h in the the Node source tree). V8 JavaScript,C++类库,作为 JavaScript 的接口类,主要用于创建对象、 调用方法等功能。大部分功能在头文件 v8.h (在 node 文件夹下的路径为 deps/v8/include/v8.h)中有详细文档。 libev, C event loop library. Anytime one needs to wait started we create a file hello.cc: 首先我们需要创建一个 hello.cc 文件: #includeusing namespace v8; extern "C" void init (Handle 0 码力 | 153 页 | 1.21 MB | 1 年前3
Node.js在YunOS中的最佳实践 模块化、NaZve互调、事件模型 Node.js的不足 作为JavaScript虚拟机还不成熟 (缺少完整的libcore) ? 9 与V8强绑定,解耦或升级很困难 (naZve调用强依赖V8接口) ? CPU密集的计算场景中存在性能问题 (单线程,事件驱动,GC效率低) ? Node.js在YunOS中的最佳实践 10 JS code 16 性能优化的实践(二) Code cache: 充分利用V8引擎的能力,预先将JavaScript代码编译好生成cache文件 运行时加载cache文件,跳过编译过程,直接运行预编译的代码,提高运行效率 a.js Compile Zme: V8 a.js.cache Run Zme: requie(‘a.js’); load a0 码力 | 20 页 | 1.37 MB | 1 年前3
ThinkJS 2.2 中文文档} 注 :ThinkJS 里所有的类都会继承 think.base 基类。 使用 Babel 编译 虽然现在的 Node.js 版本已经支持了很多 ES6 的特性,但这些特性现在还只是实现了,V8 里还没 有对这些特性进行优化。如: */yield 等功能。 所以建议使用 Babel 来编译,一方面可以使用 ES6 和 ES7 几乎所有的特性,另一方面编译后的性 能也比默认支持的要高。 : co 2、 */yield 无法和 Arrow Function 一起使用。 3、 */yield 调用另一个 */yield 时,需要使用 yield * ,带来不便。 4、目前 V8 对 */yield 还没有做优化,最好也通过 Babel 来编译。 所以完全可以使用 ES7 里的 async/await 来代替 */yield ,然后使用 Babel 编译来运行。 升级指南 //模版引擎 content_type: 'text/html', //输出模版时发送的 Content-Type file_ext: '.html', //⽂文件的扩展名 file_depr: '_', //控制器器和操作之间的连接符 root_path: think.ROOT_PATH + '/view', //视图⽂文件的根⽬目录 adapter: { //模版引擎需要的配置项0 码力 | 277 页 | 3.61 MB | 1 年前3
The Node.js Handbook
much JavaScript do you need to know to use Node? 5. Differences between Node and the Browser 6. The V8 JavaScript Engine 6.1. Other JS engines 6.2. The quest for performance 6.3. Compilation 7. Run JavaScript runtime environment. It is a popular tool for almost any kind of project! Node.js runs the V8 JavaScript engine, the core of Google Chrome, outside of the browser. This allows Node.js to be very find ways to make JavaScript run faster. The engine that Node.js uses under the hood, V8 (also known as Chrome V8 for being the open-source JavaScript engine of The Chromium Project), improved significantly0 码力 | 161 页 | 1.66 MB | 1 年前3
Node 的设计错误因此⽽而严重⽼老老化 遗憾:安全性 • V8 本身是⼀一个⾮非常好的安全沙箱。 • 如果我对如何维护某些应⽤用程序进⾏行行更更多的思考,Node 可能会拥有⼀一些其他任何 语⾔言都⽆无法获得的安全保证。 • 示例例:您的 linter 不不应该完全访问您的计算机和⽹网络。 遗憾:构建系统(GYP) • 构建系统⾮非常困难且⾮非常重要。 • V8(通过Chrome)开始使⽤用GYP,并且我切换了了 不不是⼀一个丑陋陋的内部界⾯面,它暴暴露露给任何试图绑定到 V8 的⼈人。 • 这对⽤用户来说是⼀一个可怕的经历。这是⼀一种披着 Python 外⾐衣的假 JSON。 遗憾:构建系统(GYP) • GYP 的持续使⽤用可能是 Node 核⼼心最⼤大的故障。 • 我应该提供⼀一个核⼼心的外部功能接⼝口(FFI),⽽而不不是指导⽤用户编写 C++ 来绑定 到 V8 • 许多⼈人很早就建议搬到FFI(也就是 免责声明:我只是提出了了⼀一个初具雏形的原型。 除⾮非你急于卷起袖⼦子跳进 lldb,否则不不要费劲去尝试建造它。 即便便如此… Deno https://github.com/ry/deno V8上⼀一个安全的 TypeScript 运⾏行行时 Deno ⽬目标:安全 • 利利⽤用 JavaScript 是⼀一个安全沙箱的事实。 默认情况下,脚本应该在没有任何⽹网络或⽂文件系统写访问的情况下运⾏行行。0 码力 | 28 页 | 767.84 KB | 1 年前3
Release Notes for Node.js 18REQUIRED INFRASTRUCTURE COMPONENT VERSIONS CHAPTER 2. FEATURES 2.1. NEW AND CHANGED FEATURES 2.1.1. V8 JavaScript engine upgraded to v10.2 2.1.2. Default values for HTTP timeouts 2.1.3. Blob and BroadcastChannel documentation. 2.1.1. V8 JavaScript engine upgraded to v10.2 This release includes an upgrade of the V8 JavaScript engine to v10.2, which is part of Chromium 101. The upgraded V8 JavaScript engine includes ordinary property stores For more information about the changes that are available in the V8 JavaScript Engine, see the V8 blog. 2.1.2. Default values for HTTP timeouts This release includes the following0 码力 | 18 页 | 106.27 KB | 1 年前3
Node.js - the coredisambiguate it from other nodes.” https://github.com/joyent/node/wiki/FAQ Runs on top of Chrome V8 (see next slide) Implemented in C++ and JavaScript Supported on Linux, Mac OS X and Windows Created application can benefit from asynchronous, non-blocking I/O application is not compute-intensive V8 engine is fast enough prefer callback or actor models of concurrency over thread-based approach with Chrome V8 From Google Used by Chrome browser and Node.js Implemented in C++ Currently supports ECMAScript 5 Node adopts the JavaScript syntax supported by V8 so will support ES6 when V8 supports0 码力 | 124 页 | 7.87 MB | 1 年前3
NodeJS 中文文档 V0.2.3数据流或者文件时,必 须要操作二进制数据流。 node 提供了一些方法来创建、操作和接收二进制数据流。 原始的数据保存在 Buffer 类的实例中。Buffer 类似于一个整数数组,不同之处在于它和在 V8内存堆之外分配的 一段内存数据相对应。Buffer 对象的大小不能调整。你可以通过"require('buffer').Buffer"来使用这个类。 Buffer 对象是全局对象。 Buffer { rss: 4935680 , vsize: 41893888 , heapTotal: 1826816 , heapUsed: 650472 } heapTotal 和 heapUsed 表示 V8占用的内存。 process.nextTick(callback) process.nextTick(callback) process.nextTick(callback) process.nextTick(callback) 函数类似(对象名首字母'S'的大小写不同),不同的是此函数是 Script 对象的 方法。script.runInThisContext 函数执行对象中的代码并返回结果。 执行的代码并不会访问本地作用域,但是可 以访问全局作用域(v8: in actual context)。 例子:使用 script.runInThisContext 函数实现代码的一次编译多次执行。 var Script = process.binding('evals')0 码力 | 62 页 | 542.14 KB | 1 年前3
ThinkJS 2.0 中文文档�������������������������� � �ThinkJS ��������� think.base ��� ����� Node.js ��������� ES6 ������������������V8 ������� ��������� */yield ���� ������ Babel ����������� ES6 � ES7 ��������������������� ������� � co 2� */yield ��� Arrow Function ����� 3� */yield ����� */yield ������ yield * ������ 4��� V8 � */yield ������������ Babel ���� �������� ES7 �� async/await ��� */yield ����� Babel ������ 20 码力 | 238 页 | 1.87 MB | 1 年前3
ThinkJS 2.1 DocumentationFunction together. 3. When one */yield need call another */yield , we need use yield * command 4. V8 has not made optimazition for */yield , so we recommend you to use Babel. With Babel, you can use ES70 码力 | 148 页 | 1.69 MB | 1 年前3
共 16 条
- 1
- 2













