Skip to content
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

perf: move from Buffer to zero-copy BufferSlice #8574

Merged
merged 1 commit into from
Nov 29, 2024
Merged

perf: move from Buffer to zero-copy BufferSlice #8574

merged 1 commit into from
Nov 29, 2024

Conversation

h-a-n-a
Copy link
Collaborator

@h-a-n-a h-a-n-a commented Nov 29, 2024

Summary

Use BufferSlice.

The main difference between BufferSlice and Buffer is the prior one is zero-copy if passing from JS runtimes to Rust.
However, the second one does not have this benefit. Under the hood, Buffer leverages thread-safe function to free when it's no longer needed. BufferSlices are just collected by finalizers registered on the fly.

BufferSlice cannot be used between functions and Buffer can.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@github-actions github-actions bot added release: performance release: performance related release(mr only) team The issue/pr is created by the member of Rspack. labels Nov 29, 2024
Copy link

netlify bot commented Nov 29, 2024

Deploy Preview for rspack ready!

Name Link
🔨 Latest commit c3f0bf1
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/6749721e3625d60008eabec2
😎 Deploy Preview https://deploy-preview-8574--rspack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@h-a-n-a h-a-n-a marked this pull request as ready for review November 29, 2024 09:00
@h-a-n-a h-a-n-a enabled auto-merge (squash) November 29, 2024 09:00
@h-a-n-a h-a-n-a merged commit 5a967f7 into main Nov 29, 2024
40 checks passed
@h-a-n-a h-a-n-a deleted the napi-buf branch November 29, 2024 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: performance release: performance related release(mr only) team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants