-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
src,lib: remove the cost of encoding parameter serialization #56047
base: main
Are you sure you want to change the base?
Conversation
Review requested:
|
b01ae01
to
db3069b
Compare
db3069b
to
32ce431
Compare
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.
LG
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.
lgtm
Is this unfinished or not? It's not draft but on slack you wrote it's not finished? |
CI fails everywhere. It fails to build. |
if (args.Length() >= 1) { | ||
encoding = ParseEncoding(env->isolate(), args[0], BUFFER); | ||
static_cast<ENCODING>(args[0].As<v8::Uint32>()->Value()); |
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.
Seems this line is not doing anything?
static_cast<ENCODING>(args[0].As<v8::Uint32>()->Value()); | |
encoding = static_cast<ENCODING>(args[0].As<v8::Uint32>()->Value()); |
I guess you wanted it to be like this ^ ?
@@ -1385,7 +1385,7 @@ static void ReadLink(const FunctionCallbackInfo<Value>& args) { | |||
THROW_IF_INSUFFICIENT_PERMISSIONS( | |||
env, permission::PermissionScope::kFileSystemRead, path.ToStringView()); | |||
|
|||
const enum encoding encoding = ParseEncoding(isolate, args[1], UTF8); | |||
auto encoding = static_cast<ENCODING>(args[1].As<v8::Uint32>()->Value()); |
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.
IMHO, it's good to let this (and others in this file) remain const
The goal is to remove the ability to send string encoding values (such as "utf8", "latin1" etc.) to C++. Result of this work will enable adding more V8 fast APIs and improve the performance of all functions (small or big it doesn't matter) that use encoding as a parameter.
PS: I did a similar work on Cloudflare workers: cloudflare/workerd#2478
cc @nodejs/performance @lemire @jasnell @mcollina @ronag