You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Incremental compilation of Node.js is slow. Currently on a powerful
Linux machine, it takes about 5.8 seconds to compile
`gen/node_snapshot.cc` with g++.
As in the previous PR which dealt with `node_js2c`, we add a new flag
`--use-string-literals` to `node_mksnapshot`. When this flag is set, we
emit string literals instead of array literals for the snapshot blob and
for the code cache, i.e.:
```c++
// old: static const uint8_t X[] = { ... };
static const uint8_t *X = "...";
```
I only enabled the new flag on Linux/macOS, since those are systems that
I have available for testing. On my Linux system with gcc, it speeds up
compilation of this file by 3.7s (5.8s -> 2.1s). On my Mac system with
clang, it speeds up compilation by 1.7s (3.4s -> 1.7s).
Again, the right thing here is probably to generate separate files for
the snapshot blob and for each code cache output, but this is a nice
intermediate speedup.
The thing I'm most unsure about in this PR is how to actually thread the
argument through. I considered adding it to the general argument parser,
but that felt strange, since this flag only makes sense during the build
process. So I kind of hacked it in, which also feels weird. Suggestions
are very welcome.
Refs: #47984
Refs: #48160
0 commit comments