-
Notifications
You must be signed in to change notification settings - Fork 69
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
V2: Avoid JIT deoptimizations #836
Conversation
@@ -13,6 +13,7 @@ | |||
"generate:js": "protoc --es_out=src/gen/js --es_opt=ts_nocheck=false,target=js+dts,import_extension=.js --proto_path=. $(buf ls-files extra) --proto_path=$(upstream-include test) $(upstream-files test) google/protobuf/type.proto", | |||
"postgenerate": "license-header src/gen", | |||
"perf": "tsx src/perf.ts benchmark '.*'", | |||
"profile": "dexnode dist/esm/perf.js run 'fromBinary perf-payload.bin' 10000", |
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.
The resulting logs can be inspected with the deopt explorer. Seems worth keeping this script and dep.
// eslint-disable-next-line no-case-declarations | ||
const [key, val] = readMapEntry(field, reader, options); | ||
message.setMapEntry(field, key, val); | ||
readMapEntry(message, field, reader, options); |
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.
Avoiding an eager bailout here.
listKind: undefined, | ||
mapKind: undefined, | ||
mapKey: undefined, | ||
delimitedEncoding: undefined, |
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.
Adding these properties means that the JIT can use the same map. It adds some bytes to the bundle size, but that's always the trade-off. I think it's worth it here for the >10% gain.
Following #834, we can make another - but smaller - performance improvement by avoiding a couple of deopts in v8: