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

Fix and expand Array.apply optimization, part II #9461

Merged
merged 2 commits into from
Jan 28, 2021

Conversation

retronym
Copy link
Member

Fixes scala/scala-dev#760

Relates to #9356

The extension to the optimization in Cleanup of Array.apply
assumed that the argument array was non-primitive.  This broke
compilation of spire (code minimized to test/files/run/sd760a.scala)

I also found a path to the same bug without specialization, by using
a generic type parmater bounded by a primitive. This is in
test/files/run/sd760b.scala

The fix here is straight forward -- disable this optimization when the
argument array is primitive.
Avoid boxing the elements in favour of bulk clone of the varargs
array into the result array, when the runtime type of the
class-tag-generated result array is the same as the varargs array.
@scala-jenkins scala-jenkins added this to the 2.12.14 milestone Jan 28, 2021
@retronym retronym added the performance the need for speed. usually compiler performance, sometimes runtime performance. label Jan 28, 2021
@retronym retronym changed the title Fix and expand Array.apply optimization Fix and expand Array.apply optimization, part II Jan 28, 2021
@SethTisue SethTisue merged commit 5f6e5a1 into scala:2.12.x Jan 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance the need for speed. usually compiler performance, sometimes runtime performance.
Projects
None yet
3 participants