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

Improve performance of parallel operations #20

Merged
merged 2 commits into from
Jul 11, 2017

Conversation

arnecls
Copy link
Contributor

@arnecls arnecls commented Jul 11, 2017

This PR replaces the main service mutex with two read write mutexes to improve the speed of parallel operations on already compiled expressions. All critical sections have been reduced to the bare minimum. This leads to a performance improvement of ~250% on parallel operations.

I added a new benchmark to be able to compare the speed and validity of parallel operations.
The results are as follows:

Master:
BenchmarkParallelCaptures-8    	    5000	    209069 ns/op	    4640 B/op	       5 allocs/op

This branch:
BenchmarkParallelCaptures-8    	   30000	     61049 ns/op	    4721 B/op	       5 allocs/op

Please note that no mutexes would be required if further API changes would be introduced to this library:

We created a fork that does exactly this but IMO contains too many other changes to be merged back to this repository. If you are interested, please see https://github.com/trivago/grok.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.8%) to 95.035% when pulling e4222b3 on arnecls:mutex_performance into d73e972 on vjeantet:master.

@vjeantet vjeantet merged commit ce01e59 into vjeantet:master Jul 11, 2017
@vjeantet
Copy link
Owner

thanks I will have a look

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.

3 participants