GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||
GeezerVison is showing github.com — src: stop copying code cache by kvakil · Pull Request #47144 · nodejs/node Conversation
Contributor
The code cache is quite large - around 1.3 MiB. Change the code to use non-owning buffers to avoid copying it. For starting up an otherwise empty main isolate, this saves around 1.3 MiB of unique set size memory (9.9 MiB -> 8.6 MiB) and 1.1ms elapsed time (22.9 ms -> 21.8 ms). Copying the code cache is unnecessary since:
(Admittedly point (2) feels a little fragile from a lifetime perspective, and I would be happy to restrict this optimization to the builtin snapshot.) $ perf stat -r 100 -e ... ./node -e 0 Performance counter stats for './node -e 0' (100 runs): 21.78 msec task-clock 2760 page-faults 113161604 instructions 18437648 branches 423230 branch-misses 853093 cache-references 41474 cache-misses 0.0225473 +- 0.0000504 seconds time elapsed ( +- 0.22% ) $ perf stat -r 100 -e ... ./node-main -e 0 Performance counter stats for './node-main -e 0' (100 runs): 22.91 msec task-clock 3102 page-faults 114890673 instructions 18751329 branches 428909 branch-misses 895721 cache-references 45202 cache-misses 0.0233760 +- 0.0000741 seconds time elapsed ( +- 0.32% )
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Collaborator
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Collaborator
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
joyeecheung
approved these changes
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM % nits
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsUh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page.
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
anonrig
approved these changes
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Collaborator
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
17 tasks
legendecas
approved these changes
addaleax
reviewed
Comment on lines
507
to
508
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
or
Suggested change
(this header refers to
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
19 tasks
19 tasks
The code cache is quite large - around 1.3 MiB. Change the code to use
non-owning buffers to avoid copying it. For starting up an otherwise
empty main isolate, this saves around 1.3 MiB of unique set size memory
(9.9 MiB -> 8.6 MiB) and 1.1ms elapsed time (22.9 ms -> 21.8 ms).
Copying the code cache is unnecessary since:
1. for the builtin snapshot, the code cache data has static lifetime.
2. for non-builtin snapshots, we create copies of the code cache data in
`SnapshotDeserializer::ReadVector`. These copies are owned by the
`Environment` (through `IsolateData` -> `SnapshotData`), so they
won't be deallocated.
3. a worker thread can copy a parent's isolate's code cache, but in that
case we still know that the parent isolate will outlive the worker
isolate.
(Admittedly point (2) feels a little fragile from a lifetime
perspective, and I would be happy to restrict this optimization to the
builtin snapshot.)
```console
$ perf stat -r 100 -e ... ./node -e 0
Performance counter stats for './node -e 0' (100 runs):
21.78 msec task-clock
2760 page-faults
113161604 instructions
18437648 branches
423230 branch-misses
853093 cache-references
41474 cache-misses
0.0225473 +- 0.0000504 seconds time elapsed ( +- 0.22% )
$ perf stat -r 100 -e ... ./node-main -e 0
Performance counter stats for './node-main -e 0' (100 runs):
22.91 msec task-clock
3102 page-faults
114890673 instructions
18751329 branches
428909 branch-misses
895721 cache-references
45202 cache-misses
0.0233760 +- 0.0000741 seconds time elapsed ( +- 0.32% )
```
kvakil
force-pushed
the
doNotCopyCodeCache
branch
from
f4833ff to
eb99a86
Compare
Collaborator
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
This was referenced
joyeecheung
approved these changes
Collaborator
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
anonrig
approved these changes
This was referenced
22 tasks
Collaborator
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Collaborator
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
targos
pushed a commit
that referenced
this pull request
The code cache is quite large - around 1.3 MiB. Change the code to use
non-owning buffers to avoid copying it. For starting up an otherwise
empty main isolate, this saves around 1.3 MiB of unique set size memory
(9.9 MiB -> 8.6 MiB) and 1.1ms elapsed time (22.9 ms -> 21.8 ms).
Copying the code cache is unnecessary since:
1. for the builtin snapshot, the code cache data has static lifetime.
2. for non-builtin snapshots, we create copies of the code cache data in
`SnapshotDeserializer::ReadVector`. These copies are owned by the
`Environment` (through `IsolateData` -> `SnapshotData`), so they
won't be deallocated.
3. a worker thread can copy a parent's isolate's code cache, but in that
case we still know that the parent isolate will outlive the worker
isolate.
(Admittedly point (2) feels a little fragile from a lifetime
perspective, and I would be happy to restrict this optimization to the
builtin snapshot.)
```console
$ perf stat -r 100 -e ... ./node -e 0
Performance counter stats for './node -e 0' (100 runs):
21.78 msec task-clock
2760 page-faults
113161604 instructions
18437648 branches
423230 branch-misses
853093 cache-references
41474 cache-misses
0.0225473 +- 0.0000504 seconds time elapsed ( +- 0.22% )
$ perf stat -r 100 -e ... ./node-main -e 0
Performance counter stats for './node-main -e 0' (100 runs):
22.91 msec task-clock
3102 page-faults
114890673 instructions
18751329 branches
428909 branch-misses
895721 cache-references
45202 cache-misses
0.0233760 +- 0.0000741 seconds time elapsed ( +- 0.32% )
```
PR-URL: #47144
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
author ready
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. | ||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |