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

Performance tuning #206

Merged
merged 7 commits into from
Feb 3, 2020
Merged

Performance tuning #206

merged 7 commits into from
Feb 3, 2020

Conversation

niieani
Copy link
Owner

@niieani niieani commented Feb 3, 2020

  • switch to use arrays of chars internally, rather than iterating the strings every time
  • tuned performance by switching to prepared RegExps when validating strings
  • added benchmarking to compare versions

Here's how performance looks with these changes:

1.2.2	 	decoding	 67,839 ops/sec ±0.32% (196736 samples)
2.1.0	 	decoding	 21,974 ops/sec ±0.34% (65133 samples)
this(dist)	decoding	 95,617 ops/sec ±0.29% (274244 samples)
this		decoding	 99,728 ops/sec ±0.29% (285774 samples)

1.2.2	 	encoding	 139,561 ops/sec ±0.23% (393444 samples)
2.1.0	 	encoding	 81,586 ops/sec ±0.31% (235682 samples)
this(dist) 	encoding	 210,082 ops/sec ±0.26% (575353 samples)
this		encoding	 213,644 ops/sec ±0.25% (583851 samples)

Not only fixes the regression from v2.1.0 (#79), looks significantly better than v1. 🎉

@niieani niieani merged commit 16743b8 into master Feb 3, 2020
@niieani niieani deleted the perf-tuning branch February 3, 2020 21:48
@niieani
Copy link
Owner Author

niieani commented Feb 3, 2020

🎉 This PR is included in version 2.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

1 participant