twitter / algebird

Abstract Algebra for Scala
https://twitter.github.io/algebird
Apache License 2.0
2.29k stars 345 forks source link

add a new mutable PriorityQueue Monoid #513

Open johnynek opened 8 years ago

johnynek commented 8 years ago

in: https://github.com/twitter/algebird/blob/develop/algebird-core/src/main/scala/com/twitter/algebird/mutable/PriorityQueueMonoid.scala

the issue is that the PriorityQueue holds a reference to the Ordering. On serialization that can be a major cost.

We never need to embed the Ordering if we had an implementation that always accepts the Ordering on each method call that uses it, and the Monoid would always have it.

This could really improve the performance of a few methods (sortedTake) in scalding.

poslegm commented 7 years ago

I'm not a algebird developer and I may be wrong, but the only way to do this is breaking the inheritance from the Monoid and Semigroup classes (due to changes in method signatures).

This will work, but maybe this will break the algebird ideology.