Explained

WebAssembly is a replacement for JavaScript!
C++/Rust developers can now code front-end applications!
WebAssembly is faster than JavaScript!
WebAssembly! WebAssembly!

How many times do you hear these statements? Me, a lot. So I collect the most popular myths about WebAssembly and tell you the truth behind them.

Are you interested? Welcome!

Read Full Article

Recently, I faced an issue with requiring native bindings in JavaScript code, so I researched it. If you ever used commands, like require(‘my_module.node’) but don’t know how they work from JavaScript perspective — this article is for you.

What is .node files and why do we need them?

Sometimes, we are using npm packages that have native bindings for their purposes. Sometimes, we are building our own C++ code to extend the Node.js functionality for our own purposes. In both cases, we need to build an external native code to an object that can be usable by Node.js.

And that’s what .node files are for. .node files are dynamically shared objects that Node.js can load to its environment. Making an analogy here, I would say that .node files are very similar to .dll or .so files.

Read Full Article

In my previous article, I was talking about Node.js and why it’s fast. Today, I want to talk about V8.

I suppose some of you heard that JavaScript executes as fast as C++. Some of you don’t understand how it’s even possible. JavaScript is a dynamically typed language with Just in Time (JIT) compilation, when C++ is static-typed language with Ahead of Time (AoT) compilation. And somehow, optimised JavaScript code executes a little slower than C++ or even with the same speed.

To understand why that is, you need to know some basics of V8 implementation. It’s a huge topic, so I will only explain key features of V8 in this post. If you want more details, such as hidden classes, SSA, IC,… they will be in my next article.

Read Full Article

Here I am again with an article about Node.js! Today I want to speak about another Node.js advantage — execution speed. What do I mean by “execution speed”?

It can be anything ranging from calculating Fibonacci sequence to querying database.

When talking about web-services, execution speed comprises everything that is needed to process requests and send the response to the client. That’s what I mean — time spent on processing request, starting from opening connection to client receiving the response.

As soon as you understand what’s going on in Node.js server when it processes the requests, you will realise why it is so fast.

But before talking about Node.js, let’s look at how request handling is done in other languages. PHP is the best example because it is popular and unoptimised.

Read Full Article

Hi everyone! My name is Eugene Obrezkov, and today I want to talk about one of the “scariest” platforms — Node.js. I will answer one of the most complicated questions about Node.js — “How does Node.js work?

I will present this article as if Node.js didn’t exist at all. This way, it should be easier for you to understand what’s going on under the hood.

The code found in this post is taken from existing NodeJS sources, so after reading this article, you should be more comfortable with NodeJS.

Read Full Article