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

multiple Packr instances and useBuffer() #139

Open
endel opened this issue Jun 28, 2024 · 1 comment
Open

multiple Packr instances and useBuffer() #139

endel opened this issue Jun 28, 2024 · 1 comment

Comments

@endel
Copy link
Contributor

endel commented Jun 28, 2024

As the encoding Buffer is tied to the module scope (target), when using multiple Packr instances along with .useBuffer() - that Packr instance is not ensured to be using the correct Buffer.

A workaround would be to always call .useBuffer() prior to encoding, but that implies in creating a new DataView instance before each encode.

This was referenced Jun 28, 2024
kriszyp added a commit that referenced this issue Jul 14, 2024
…t incurring extra DataView construction costs, #139
@kriszyp
Copy link
Owner

kriszyp commented Jul 14, 2024

Last commit will cache the DataView (as is done elsewhere in the code), so you can performantly switch buffers back and forth with useBuffer() (without new DataView each time).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants