How JavaScript works: inside the V8 engine?

Each Browser has own Engine for JavaScript, so if I want to learn how JavaScript works, I must learn about all the Engines?

Do the Engines translate the Code in the same Way?



I guess you don't have to unless you want to create enterprise Applications with thousands of users and every millisecond and roundtrip is important for you to safe real money.

Unless you don't want to let your application perform ideal in every single engine. We are just talking about milliseconds over here.

The overall concept over here is the same in every Engine.

If you want to dig deeper into the understanding of how the engines process your code i recommend to check out You don't know JS. It's a book series in 6 parts which you can read online for free.

After reading that I personally got a much better idea of how my code is processed by the engine. And i'm sure that the part were you need to differ between this engines is all about the performance in the millisecond area!

A brief summary of how the engines differ can be found over here: Guide to JavaScript engines. You could also check out the performance guide over here: JavaScript Engine Comparison.

Quotet from there:

There are several tools out there which can help you out with testing out the performance of your Javascript code. An accurate and convenient way to do it is to make use of the Javascript function – console.time [10] or [11], which works on most modern browsers and newer NodeJS versions. For a more accurate, non-DOM based performance testing, use the V8 internal profiler [12].

They have also listet more helpful sources!


Another discussion about Performance of JavaScript and how to test it can be found over here: How do you performance test JavaScript code? and quotet from there:

These days, the Chrome profiler and other tools are universally available and easy to use, as are console.time(), console.profile(), and Chrome also gives you a timeline view which can show you what is killing your frame rate, where the user might be waiting, etc.

Finding documentation for all these tools is really easy, you don't need an SO answer for that. 7 years later, I'll still repeat the advice of my original answer and point out that you can have slow code run forever where a user won't notice it, and pretty fast code running where they do, and they will complain about the pretty fast code not being fast enough. Or that your request to your server API took 220ms. Or something else like that. The point remains that if you take a profiler out and go looking for work to do, you will find it, but it may not be the work your users need.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.