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

SI-5017 Poor performance of :+ operator on Arrays #1739

Merged
merged 1 commit into from Jan 4, 2013

Conversation

jedesah
Copy link
Member

@jedesah jedesah commented Dec 9, 2012

Control performance of :+ and +: operator on my machine were 700-800 ms

After adding size hint on the implementation in SeqLike, it went down to 500-600 ms

But with specialixed implementation in ArrayOps, brings it down to 300-400 ms

Unfortunatly, this method will only be called when the Array object is being referenced directly as it's type, but that should be the case enough times to justify the extra method.

I ended up removing the sizeHint in SeqLike because it made the execution of the "benchmark" slower when the Array was being manipulated as a Seq.

Side note: Interestingly enough, the benchmark performed better on my virtualized Fedora 17 with JDK 7 than natively on Mac OS X with JDK 6

Review by @axel22

result(0) = elem
Array.copy(repr, 0, result, 1, repr.length)
result
}
Copy link
Member

Choose a reason for hiding this comment

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

Is this code called from any existing tests? (Replace it with ??? and run partest to see.)

If so, mention that test in the commit comment; if not, please add a test.

@scala-jenkins
Copy link

Started jenkins job pr-scala-testsuite-linux-opt at https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/1830/

@scala-jenkins
Copy link

jenkins job pr-scala-testsuite-linux-opt: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/1830/

@scala-jenkins
Copy link

Started jenkins job pr-rangepos at https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/1118/

@scala-jenkins
Copy link

jenkins job pr-rangepos: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/1118/

@axel22
Copy link
Member

axel22 commented Dec 10, 2012

After addressing the issue of missing tests, LGTM.

@adriaanm
Copy link
Contributor

please use the SI-5017 naming convention

Control performance of :+ and +: operator on my machine were 700-800 ms

After adding size hint on the implementation in SeqLike, it went down to 500-600 ms

But with specialixed implementation in ArrayOps, brings it down to 300-400 ms

Unfortunatly, this method will only be called when the Array object is being referenced directly as it's type, but that should be the case enough times to justify the extra method.

I ended up removing the sizeHint in SeqLike because it made the execution of the "benchmark" slower when the Array was being manipulated as a Seq.

Side note: Interestingly enough, the benchmark performed better on my virtualized Fedora 17 with JDK 7 than natively on Mac OS X with JDK 6
@jedesah
Copy link
Member Author

jedesah commented Dec 23, 2012

Sorry for the delay. Got caught up finishing work stuff.

@scala-jenkins
Copy link

Started jenkins job pr-rangepos at https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/1222/

@scala-jenkins
Copy link

jenkins job pr-rangepos: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/1222/

@scala-jenkins
Copy link

Started jenkins job pr-scala-testsuite-linux-opt at https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/1938/

@scala-jenkins
Copy link

jenkins job pr-scala-testsuite-linux-opt: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/1938/

@JamesIry
Copy link
Contributor

JamesIry commented Jan 4, 2013

Looks like all the discussion has been addressed and LGTM

paulp added a commit that referenced this pull request Jan 4, 2013
SI-5017 Poor performance of :+ operator on Arrays
@paulp paulp merged commit 54aca49 into scala:2.10.x Jan 4, 2013
@jedesah jedesah deleted the Array_opt branch August 5, 2013 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants