thlorenz / v8-perf

⏱️ Notes and resources related to v8 and thus Node.js performance
2.2k stars 112 forks source link

turbo: updating all docs to current state #14

Closed thlorenz closed 6 years ago

thlorenz commented 6 years ago

Updating to latest v8

Updated all the documents to reflect changes in v8, mainly the compiler chain as well as the garbage collector.

Numerous documents focus on one topic specifically and I include a quick summary + link to the document below as well as the diff. I did that b/c I feel looking at the diff makes things much harder to read than when looking at the original file, but comments would make sense in the diff. I'm hoping that the experts from the v8 team and community can review a document that most matches their expertise and point out any information that is not quite correct so I can correct it.

Please note that all documents inside the ./crankshaft folder are the old versions and don't need to be reviewed. Please review the ones at the top level of this repo (and linked below) instead.

Obviously pull requests are also very welcome :)

Compiler

The v8 compiler | diff document outlines the v8 compiler pipeline including the Ignition Interpreter and TurboFan optimizing compiler. It explains how information about your code is executed to allow optimizations, how and when deoptimizations occur and how features like the CodeStubAssembler allowed reduce performance bottlenecks found in the older pipeline.

Language Features

The language features | diff document lists JavaScript language features and provides info with regard to their performance mainly to provide assurance that performance of most features is no longer an issue as it was with the previous compiler pipeline.

Garbage Collector

The v8 garbage collector | diff document talks about how memory is organized on the v8 heap, how garbage collection is performed and how it was parallelized as much as possible to avoid pausing the main thread more than necessary.

Memory Profiling

The memory profiling | diff document explains how JavaScript objects are referenced to form a tree of nodes which the garbage collector uses to determine collectable objects. It also outlines numerous techniques to profile memory leaks and allocations.

Inspection and Performance Profiling

Inside the inspection | diff document you will find techniques that allow you to profile your Node.js or web app, how to produce flamegraphs and what flags and tools are available to gain an insight into operations of v8 itself.

Snapshots and Code Caching

This document | diff includes information as to how v8 uses caching techniques in order to avoid recompiling scripts during initialization and thus achieve faster startup times.

Runtime Functions

The runtime functions | diff document gives a quick intro into C++ functions accessible from JavaScript that can be used to provide information of the v8 engine as well as direct it to take a specific action like optimize a function on next call.

cc @mraleph @bmeurer @mcollina @mathiasbynens @fhinkel @ofrobots

I realize these are by no means all people knowledgable about these topics, so please feel free to add more via a comment.

I very much appreciate anyone taking the time to help make this a valuable resource with correct and up to date information.

thlorenz commented 6 years ago

Thanks for the reviews so far @bmeurer, @mathiasbynens and @davidmarkclements.

I'm terribly sorry for the confusion as to what's the new content to be reviewed. I addressed the issues that did affect the new content (except @davidmarkclements as they were added after I committed my fixes) and hope you can find the time to review those new documents as well so I can fix any issues there as well.

As stated anything in the ./crankshaft folder needs no review as that's old content that I keep there just for future reference. However lots of content was added in the top level of this repo and I linked them directly from the PR message.

thlorenz commented 6 years ago

@mathiasbynens I addressed the SMIs issue in 62580518f3dc6e94c4257ae45e8128d75fab697a. (github doesn't let me comment on your comment .. no idea why) Oh hold on you want Smi or SMI? Now I'm confused. I changed them all to SMIs :) Seems like I read you regex backwards just cause SMI makes more sense to me.

Should be fixed in d5e50ef4156f0a49ab6cebfaa952ea6b4b449aa2