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

Make browser-compatible, reduce allocations during encoding and decoding #4

Merged
merged 1 commit into from
Jul 10, 2023

Conversation

liamdon
Copy link
Contributor

@liamdon liamdon commented Jul 10, 2023

  1. Replace direct usage of node.js Buffer API to allow the library to work in both browser and node environments

  2. Improve performance by not allocating buffer in every encode call and v in every decode call - instead use one preallocated buffer for both cases. This is safe because:

  • Both buffer and v always have length 26
  • Every element is written
  • Both are internal and are not returned to the caller, so don't need a unique reference.

@ongteckwu
Copy link
Owner

Thank you makes a lot of sense.

@ongteckwu ongteckwu merged commit a17368b into ongteckwu:main Jul 10, 2023
@ongteckwu
Copy link
Owner

Updated to v0.2.8

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

Successfully merging this pull request may close these issues.

2 participants