In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "what the engine in node.js refers to", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "what engine in node.js refers to" this article.
The engine of node.js is "Chrome V8". Node.js is mainly composed of Chrome V8 engine, standard library and native modules; among them, V8 engine is responsible for parsing and executing JavaScript code, it compiles JS code directly into native machine code, and uses caching mechanism to improve performance.
This tutorial operating environment: windows7 system, nodejs version 12.19.0, DELL G3 computer.
What is nodejs?
Node.js is a JavaScript runtime environment based on the Chrome V8 engine.
Node.js uses an event-driven, non-blocking Istroke O model to make it lightweight and efficient.
To put it simply, Node.js is the JavaScript that runs on the server side and uses JavaScript to program on the server side.
Node.js is a development platform that allows JavaScript to run on the server side. It extends the tentacles of JavaScript to the server side and can be on a par with PHP, JSP, Python and Ruby.
Node.js is not an independent language, unlike PHP, JSP, Python, Perl, Ruby, which is both a language and a platform, Node.js uses JavaScript for programming and runs on the JavaScript engine (V8).
The composition of nodejs development is to program with a large number of third-party packages provided by the npm development community plus the basic ECMAScript scripting language and a series of programming interfaces provided by the node platform.
The composition of Node.js
Node.js runtime is mainly composed of V8 engine, standard library and local modules, especially the number of local modules, which determines the strength of Node.js functions from the bottom.
1) V8 engine
The V8 engine is the JavaScript interpreter, which parses and executes JavaScript code.
V8 engine draws lessons from many technologies of Java virtual machine and C++ compiler, it compiles JavaScript code directly into native machine code, and uses caching mechanism to improve performance, which makes JavaScript run as fast as binary programs.
2) Local module
Node.js integrates a number of high-performance open source libraries, which are implemented in the C _ Candle + language, such as:
The module describes libuv, a cross-platform, event-driven, asynchronous Imax O library. However, libuv is not limited to Imax O, it also provides other functions such as process management, thread pool, signal processing, timer and so on.
In Linux, everything is a file, and the Icano here includes not only file reading and writing, but also database reading and writing, network communication (socket) and so on. NmpNode.js package manager, you can download packages, install packages, uninstall packages, update packages, upload packages, etc. Http_parser is a lightweight HTTP parser written in C language to support Web application development. Zlib industrial-grade data compression / decompression module, Nodejs uses zlib to create synchronous, asynchronous or streaming compression / decompression interface. OpenSSL this module provides many closely tested encryption / decryption functions that modern Web relies on for security, such as SSL protocol and https protocol. C-ares asynchronous DNS query and parsing libraries.
Node.js runs JavaScript code directly on the computer and gives JavaScript powerful capabilities, so its native module is quite different from the runtime in the browser, if not relevant. Node.js abandoned browsers almost completely and built a whole new set of JavaScript runtimes from scratch.
3) Standard library
The native module is written in JavaScript Cash +, while Node.js is intended for JavaScript developers, so it is necessary to encapsulate the native module's Cmax Cure + interface, provide an elegant set of JavaScript interfaces to developers, and keep the interface consistent on different platforms (operating systems).
This set of JavaScript interfaces is the Node.js standard library. Whether the standard library is elegant and powerful determines the ease of use of Node.js and directly affects the market performance of Node.js.
Summary
The V8 engine and many local modules are ready-made, and others have built the wheels. The main job of Node.js is to select the appropriate modules, integrate them, and write JavaScript interfaces.
Of course, not all local modules can be found, and Node.js has written several modules of its own, typical of which is Libuv. Libuv is the most core and basic module of Node.js, and Node.js is built entirely on Libuv.
You may have heard that Node.js uses the event-based, single-threaded asynchronous I _ peg O architecture, which is the biggest feature of Node.js and the biggest difference between Node.js and other scripting languages. Node.js relies on Libuv for this capability.
Libuv is so powerful that officials have decided to split it out of Node.js and release it as a separate web library that is open source and free. Nowadays, Libuv has become very popular, and the traditional Libevent and libev libraries are also known as the "Cmax Cure + three major network libraries".
Node.js is famous mainly because it uses the V8 engine and the Libuv library: the V8 engine ensures the efficient operation of Node.js, and the Libuv library provides asynchronous Imax O capabilities based on event loops.
Summary
Node.js is a JavaScript runtime that makes JavaScript out of the browser environment and can be run directly on computers, greatly expanding the use of JavaScript. We should treat JavaScript in the same way as other programming languages such as Python, Java, Ruby, and so on. We can no longer treat it as a "gadget".
Finally, let's summarize the history of JavaScript and Node.js:
Netscape browser derives JavaScript script, which gives web page programming ability.
Chrome browser derives the V8 engine to improve the performance of JavaScript
V8 engine builds Node.js, which expands the programming ability of JavaScript.
Node.js derives the Libuv library and adds an excellent tool to web development.
The above is all the content of the article "what does engine in node.js refer to?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 252
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.