perf: use v8::String::NewFromUtf8Literal in ToV8() gin converter (#44501)

This commit is contained in:
Charles Kerr 2024-11-01 15:01:09 -05:00 committed by GitHub
parent 2081f771e4
commit b985d8eb28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -70,12 +70,10 @@ struct Converter<char[]> {
}
};
template <size_t n>
struct Converter<char[n]> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate, const char* val) {
return v8::String::NewFromUtf8(isolate, val, v8::NewStringType::kNormal,
n - 1)
.ToLocalChecked();
template <size_t N>
struct Converter<char[N]> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate, const char (&val)[N]) {
return v8::String::NewFromUtf8Literal(isolate, val);
}
};