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

simplification for spacesaver. before buckets were kept in an option str... #308

Merged
merged 3 commits into from
Jul 3, 2014
Merged

simplification for spacesaver. before buckets were kept in an option str... #308

merged 3 commits into from
Jul 3, 2014

Conversation

koertkuipers
Copy link
Contributor

...ucture called bucketsOption to defer their computation if not needed. upon a more careful look it turns out this is not very often. the idea that buckets does not have to be calculated in case of repeated merges of SSManys was the original main motivation (since this is what a hadoop reducer will do), but the merge depends on min which depends on buckets in almost all situations, so bucketsOption doesn't help us much here. bucketsOption can be hurtful if an SSMany gets serialized and deserialized, since in that case the None gets serialized and buckets has to be recomputed if needed after deserialization.

…structure called bucketsOption to defer their computation if not needed. upon a more careful look it turns out this is not very often. the idea that buckets does not have to be calculated in case of repeated merges of SSManys was the original main motivation (since this is what a hadoop reducer will do), but the merge depends on min which depends on buckets in almost all situations, so bucketsOption doesn't help us much here. bucketsOption can be hurtful if an SSMany gets serialized and deserialized, since in that case the None gets serialized and buckets has to be recomputed if needed after deserialization.
case None => SortedMap[Long, Set[T]]() ++ counters.groupBy(_._2._1).mapValues(_.keySet)
}
case class SSMany[T](capacity: Int, counters: Map[T, (Long, Long)], buckets: SortedMap[Long, Set[T]]) extends SpaceSaver[T] {
//assert(buckets.values.map(_.size).sum == counters.size)
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we remove these?

@johnynek
Copy link
Collaborator

johnynek commented Jul 2, 2014

@koertkuipers sorry I lost track of this. We are about to publish. If you can pull from develop, get the merge green, I'll merge it.

Sorry again for the delay.

johnynek added a commit that referenced this pull request Jul 3, 2014
simplification for spacesaver. before buckets were kept in an option str...
@johnynek johnynek merged commit 0e8ceb3 into twitter:develop Jul 3, 2014
@johnynek
Copy link
Collaborator

johnynek commented Jul 3, 2014

Thank you, sir.

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.

2 participants