Skip to content

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