-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optimize(core): move internal js src off heap #9713
Conversation
Since v8 only excepts one-byte external strings in ASCII/Latin-1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! This is a great simple optimization
@@ -916,7 +916,7 @@ | |||
// If signal is not null and its aborted flag is set, then return. | |||
return; | |||
} else { | |||
// If listener’s signal is not null, then add the following abort |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This character non-ascii?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really subtle but this is a right single quotation mark (0x2019).
A quick s/’/'/g
and we should be good.
rusty_v8 upgraded in #9725 with your external string APIs |
Thanks @ry. Btw, this will still require some further changes in
So external strings work, just not with snapshots yet. So I wouldn't bump Locally I've made the necessary changes to register the external refs (beyond just So this will require a little more investigating on my end. |
Perhaps there should be a CI job to check for this in future code changes. Add to linting? |
@jbergstroem It's planned, see the subtask:
|
I will add relevant bindings to |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Completed to implement a new lint rule in denoland/deno_lint#837. extFound 22 problems. I'm worried that non-ASCII characters used in click to expand
runtimeNo non-ASCII characters are found. coreFound 10 problems, but all of them are in test file click to expand
CC @AaronO |
@magurotuna Great job ! A nice additional improvement would be to show the escaped |
Closing because stale. Open a new PR if this work continues. |
This PR explores moving the internal JS code (bundled in
deno
) off the heap, as suggested by #9675Impact
Reduce per-isolate heap by
~1MB
, reducing overall memory usage (especially with many workers), with no real downside or compromise.This should also reduce snapshot sizes, resulting in faster snapshot restores and a smaller
deno
binary (these will likely be minor and weren't the core motivation)Subtasks
v8::String
srusty_v8
(Initial support for external v8 strings rusty_v8#641)JsRuntime::execute_static
ExternalReferences
in v8, so they can be captured and restored in snapshotsexecute_static
?)Notes
Non-ASCII files found with (ignores test and example files):
Non-ASCII characters in each file were then found with this regex:
[^\x00-\x7F]
Non-ASCII files and context:
runtime/js/02_console.js
: the non-ASCII chars are the tableChars (L38)op_crates/web/02_event.js
: there's a single utf8 apostrophe’
vs'
in comments (L919)op_crates/web/21_filereader.js
: there are multiple utf8 apostrophes in comments (same as above)op_crates/fetch/26_fetch.js
: same deal, same apostrophesop_crates/web/lib.deno_web.d.ts
: used§
in comment