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

Vector: Fix 2.13.2 performance regression: Restore special cases for small operands in {append,prepend}edAll #9036

Merged
merged 1 commit into from Jun 12, 2020

Conversation

retronym
Copy link
Member

@retronym retronym commented Jun 5, 2020

@scala-jenkins scala-jenkins added this to the 2.13.4 milestone Jun 5, 2020
@SethTisue SethTisue added release-notes worth highlighting in next release notes prio:hi high priority (used only by core team, only near release time) labels Jun 5, 2020
@SethTisue SethTisue modified the milestones: 2.13.4, 2.13.3 Jun 5, 2020
@SethTisue SethTisue added prio:blocker release blocker (used only by core team, only near release time) and removed prio:hi high priority (used only by core team, only near release time) labels Jun 5, 2020
@retronym retronym requested a review from szeiger June 8, 2020 03:10
@retronym retronym changed the title Restore special case for Vector.++ to detect prepends Restore special cases for small operands in {append,prepend}edAll Jun 8, 2020
@retronym retronym marked this pull request as ready for review June 8, 2020 03:10
@diesalbla diesalbla added the library:collections PRs involving changes to the standard collection library label Jun 11, 2020
Copy link
Member

@lrytz lrytz left a comment

Choose a reason for hiding this comment

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

Pushed a small cleanup.

@lrytz lrytz merged commit 3da5a0d into scala:2.13.x Jun 12, 2020
@SethTisue SethTisue changed the title Restore special cases for small operands in {append,prepend}edAll Vector: Restore special cases for small operands in {append,prepend}edAll Jun 15, 2020
@SethTisue SethTisue changed the title Vector: Restore special cases for small operands in {append,prepend}edAll Vector: Fix 2.13.2 performance regression: Restore special cases for small operands in {append,prepend}edAll Jun 15, 2020
@SethTisue SethTisue added performance the need for speed. usually compiler performance, sometimes runtime performance. and removed prio:blocker release blocker (used only by core team, only near release time) labels Jun 23, 2020

override final def appendedAll[B >: A](suffix: collection.IterableOnce[B]): Vector[B] = {
val k = suffix.knownSize
if(k == 0) this
else appendedAll0(suffix, k)
}

protected[this] def prependedAll0[B >: A](prefix: collection.IterableOnce[B], k: Int): Vector[B] = {
val tinyAppendLimit = 4 + vectorSliceCount
if (k < tinyAppendLimit /*|| k < (this.size >>> Log2ConcatFaster)*/) {
Copy link
Contributor

Choose a reason for hiding this comment

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

incorrect assumption that k is positive

Copy link
Contributor

Choose a reason for hiding this comment

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

I have no idea if this is the source of scala/bug#12564, but it might be

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
library:collections PRs involving changes to the standard collection library performance the need for speed. usually compiler performance, sometimes runtime performance. release-notes worth highlighting in next release notes
Projects
None yet
6 participants