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 improvements on the addPattern code path. Avoiding lots of unnecessary Set creations. #104

Merged
merged 1 commit into from
Jun 6, 2023

Conversation

jonessha
Copy link
Contributor

@jonessha jonessha commented Jun 6, 2023

Description of changes:

Main strategy was turning SingleByteTransition into an Iterable of itself, and then changing many methods that returned Sets to return Iterables, so that in the n=1 case, we can return a SingleByteTransition instead of a single-element set and avoid the set creation. Also, revised updateTransition in ByteMap to work on the same TreeMap instead of creating a replacement.

In my testing, this gives up to a 25% reduction in GC activity, and a 50% reduction in machine creation latency at p99.9.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@baldawar
Copy link
Collaborator

baldawar commented Jun 6, 2023

is the performance high enough to update the number within the readme ?

@jonessha
Copy link
Contributor Author

jonessha commented Jun 6, 2023

is the performance high enough to update the number within the readme ?

The performance improvement is just during machine creation, but not during matching. I don't think we have machine creation latency numbers in the README?

@baldawar
Copy link
Collaborator

baldawar commented Jun 6, 2023

oh you're right. Odd that we don't have a benchmark for this. Feels like a miss. Worth an issue?

@jonessha
Copy link
Contributor Author

jonessha commented Jun 6, 2023

oh you're right. Odd that we don't have a benchmark for this. Feels like a miss. Worth an issue?

Sure. #105

@baldawar baldawar merged commit b223ae5 into main Jun 6, 2023
3 checks passed
@jonessha jonessha deleted the perf_improvements branch June 6, 2023 23:03
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.

None yet

2 participants