Skip to content

perf(napi/parser): lazy-load raw transfer and lazy deser code #11807

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

Conversation

overlookmotel
Copy link
Contributor

@overlookmotel overlookmotel commented Jun 19, 2025

Raw transfer and raw lazy deserialization are experimental and not publicly advertised. Lazy-load all code for these features only when they're first used.

Lazy deserialization in particular requires a non-trivial amount of code.

rawTransferSupported still needs to be eagerly loaded, as user would call it before calling parseSync or parseAsync. So move it into a separate module.

@github-actions github-actions bot added the C-performance Category - Solution not expected to change functional behavior, only performance label Jun 19, 2025
Copy link
Contributor Author

overlookmotel commented Jun 19, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@overlookmotel overlookmotel marked this pull request as ready for review June 19, 2025 12:21
@overlookmotel overlookmotel force-pushed the 06-19-perf_napi_parser_lazy-load_raw_transfer_and_lazy_deser_code branch from dd2f95b to 6ed3760 Compare June 19, 2025 12:24
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Jun 19, 2025
Copy link
Contributor Author

overlookmotel commented Jun 19, 2025

Merge activity

Raw transfer and raw lazy deserialization are experimental and not publicly advertised. Lazy-load all code for these features only when they're first used.

Lazy deserialization in particular requires a non-trivial amount of code.

`rawTransferSupported` still needs to be eagerly loaded, as user would call it before calling `parseSync` or `parseAsync`. So move it into a separate module.
@graphite-app graphite-app bot force-pushed the 06-19-perf_napi_parser_lazy-load_raw_transfer_and_lazy_deser_code branch from 6ed3760 to 3a0a673 Compare June 19, 2025 12:33
graphite-app bot pushed a commit that referenced this pull request Jun 19, 2025
Pure refactor. Rename `raw-transfer/index.js` to `raw-transfer/common.js`. After #11807, it's no longer the entry point, so `index.js` is misleading.
@graphite-app graphite-app bot merged commit 3a0a673 into main Jun 19, 2025
15 checks passed
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jun 19, 2025
@graphite-app graphite-app bot deleted the 06-19-perf_napi_parser_lazy-load_raw_transfer_and_lazy_deser_code branch June 19, 2025 12:39
graphite-app bot pushed a commit that referenced this pull request Jun 19, 2025
Tiny perf optimization to raw transfer. #11807 made this whole file lazy-loaded, so no need to lazily create the `TextEncoder` any more. If the file is imported, it's going to be used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-performance Category - Solution not expected to change functional behavior, only performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant