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 vector/map parsing #28

Merged
merged 2 commits into from
Oct 11, 2017
Merged

Performance improvements on vector/map parsing #28

merged 2 commits into from
Oct 11, 2017

Conversation

leiffoged
Copy link

Hey there --

I'm using clojure-msgpack with parsing a lot of vectors in a performance critical path of my application. Profiling revealed that the seq overhead involved with both the (for ...) and the (range ...) sequences is significant.

This diff eliminates the unnecessary allocation by:
1/ unrolling them into explicit loops w/ transients
2/ using unchecked math to avoid boxing the counter

One change to call out: unpack-n now returns a vector instead of a sequence. Happy to wrap in a call to sequence if that's something you're interested in maintaining (e.g. a real sequence instead of something sequential)

Tested by invoking lein test

Copy link
Owner

@edma2 edma2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good catch!

@edma2 edma2 merged commit 338e5e5 into edma2:master Oct 11, 2017
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