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
Merge 2.12.x to 2.13.x [ci: last-only] #8763
Merge 2.12.x to 2.13.x [ci: last-only] #8763
Conversation
Instead, extends the type-case on the src array to separately deal with each type of primitive array, which can call into a specialized variant of the loop. I've also added a special case for empty arrays. This compiles as: ``` // access flags 0x1A private final static copy$mCc$sp$1([C)[Ljava/lang/Object; // parameter final src ALOAD 0 ARRAYLENGTH ISTORE 1 ILOAD 1 ICONST_0 IF_ICMPNE L0 GETSTATIC scala/Array$.MODULE$ : Lscala/Array$; INVOKEVIRTUAL scala/Array$.emptyObjectArray ()[Ljava/lang/Object; ARETURN L0 ILOAD 1 ANEWARRAY java/lang/Object ASTORE 2 ICONST_0 ISTORE 3 L1 ILOAD 3 ILOAD 1 IF_ICMPGE L2 ALOAD 2 ILOAD 3 ALOAD 0 ILOAD 3 CALOAD INVOKESTATIC scala/runtime/BoxesRunTime.boxToCharacter (C)Ljava/lang/Character; AASTORE ILOAD 3 ICONST_1 IADD ISTORE 3 GOTO L1 L2 ALOAD 2 ARETURN MAXSTACK = 4 MAXLOCALS = 4 ```
use retainIdentical where appropriate to combine trees Learning from the optimisations of HashSet bulk operations, port some of that where appropriate to HashMap - mostly around HashTrie merge - remove more allocations use System.arraycopy rather then Array.copy for performance add fast path for some trivial cases, e.g. empty add fast path to EmptyMap ++ Map, as builders use this path add allocation testing add test to ensure simple cases preserve identity on merge
Avoid IntRef and other overheads in `ScalaRuntime.{toArray, toObjectArray}`
[nomerge] optimise the addition of immutable HashMap
dont create a TreeMap if the underlying tree is unchanged
Dont create a new TreeSet if there is no change to the underlying tree
Basic TreeSet/TreeMap benchmark
A simple TreeSetBuilder
(that test is also updated in https://github.com/scala/scala/pull/8761/files) |
This reverts commit 6d49dfd.
Remaining 2.12 changes:
501533a can be skipped, it no longer applies in 2.13. @retronym I could use some help with the Context changes in 154215b. |
If a change is hard to merge 2.12 -> 2.13, I think it's better to skip it ( |
|
is this good to go, then? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The skipped changes are not directly applicable to 2.13.x.
Mostly skipped collections backports.
I skipped the benchmark in 94d8821 as I beleive it overlaps with
RedBlackTreeBenchmark
here, but maybe @mkeskells will find part of itto forward port.
Some Tuple2 avoidance within Map operations from 03387fa is skipped
but is adapted to 2.13.x and spun out to #8761.