Conversation
3bd32f2 to
486b6d7
Compare
|
benchmark summary for each benchmark
builderPlusPlusInitial - calling the first ++= on the builder - for the case where the parameters is a compatible TreeSet
builderPlusPlusLargeLarge - calling two ++= on the builder, with large non overlapping keys
builderPlusPlusSmallLarge and builderPlusPlusLargeSmall builderPlusPlusSame- calling two ++= on the builder, with a large and small datase, non overlapping keys builderPlusPlusLargeSmall
builderPlusPlusSmallLarge
builderPlusPlusSame
plusPlus - not affected by this PR - but for completeness
|
486b6d7 to
037e983
Compare
037e983 to
e8e5fc8
Compare
| final class TreeSet[A] private (tree: RB.Tree[A, Unit])(implicit val ordering: Ordering[A]) | ||
| extends SortedSet[A] with SortedSetLike[A, TreeSet[A]] with Serializable { | ||
|
|
||
| //for serialisation computability |
There was a problem hiding this comment.
If instead we make tree: RB.Tree[A, Unit] above into private val tree: RB.Tree[A, Unit], we end up renaming the its backing field to an expanded name (expanded because it is accessed from another class and madeNotPrivate). This changes the serialization fingerprint of the class.
2.13 collections use the serialization proxy pattern pervasively to avoid relying on default serialization.
| this | ||
| } | ||
|
|
||
| private object adder extends Function1[A, Unit] { |
There was a problem hiding this comment.
Of course, you could make TreeSetBuilder extend A => Unit and save the object overhead, but that's too clever by at least half
retronym
left a comment
There was a problem hiding this comment.
LGTM. I'd be comfortable with this in 2.12.11 ahead of the full backport of the 2.13 RB trees Mike is working towards for 2.12.12.
A simple TreeSetBuilder
A simple TreeSetBuilder
Avoid the creation of TreeSet objects tat are never visible, so just create one when result is called
Simple optimisation to ++= to do less work