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

SummingCache should use sumOption #290

Open
avibryant opened this issue Mar 20, 2014 · 2 comments
Open

SummingCache should use sumOption #290

avibryant opened this issue Mar 20, 2014 · 2 comments

Comments

@avibryant
Copy link
Contributor

SummingCache could buffer up multiple values for a key and sum them in one pass before flush using sumOption; this would trade memory use for performance.

If we standardized a pattern for mutable updates like HLL's updateInto, this could improve both performance and memory use.

@ianoc
Copy link
Collaborator

ianoc commented Mar 20, 2014

I've wondered a little about this, it currently is optimized for a reasonably low cache hit rate. If we get two values for a key we should merge right then than making that a list. (This path comes up often in summingbird). An alternate would be to on flush combine into a single Map[K, List[V]], and then sumOption the V's for each K. It would be interesting to see the garbage/required hit rate/sum option benefits for this to be a particularly good win.

@avibryant
Copy link
Contributor Author

Yeah, buffering up lists may not actually make any sense, but a mutable buffer pattern like HLL's updateInto is an obvious win (and we can have a default implementation of that which just does the standard plus() into some box).

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

No branches or pull requests

3 participants