Skip to content

Make scala.runtime.Comparator faster #38

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

Closed
scabug opened this issue Aug 31, 2007 · 3 comments
Closed

Make scala.runtime.Comparator faster #38

scabug opened this issue Aug 31, 2007 · 3 comments
Assignees

Comments

@scabug
Copy link

scabug commented Aug 31, 2007

Aladdin: [http://scala-webapps.epfl.ch/bugtracking/contribs/load.do?id=479 contrib 479]

With new numbers implementation some calls to == are replaced with call to scala.runtime.Comparator.equals.

That comparator works slow if operands are not equal and not instanceof Number.

I've optimized Comparator a bit. Result is: [http://mx1.ru/~yozh/scala-comparator/Comparator.java] (diff: [http://mx1.ru/~yozh/scala-comparator/Comparator.java.diff]).

I've tested with [http://mx1.ru/~yozh/scala-comparator/Test.java] and got results:

with new comparator: about 1.7 s
with orig comparator: about 2.3 s
with o.equals(o2): about 1.0 s

So overhead of old comparator in test is about 1.3 s vs. overhead of new comparator about 0.7 seconds.

Test executed on PPC notebook (1.5 HHz, 1.5Gb) on JDK 1.5.

@scabug
Copy link
Author

scabug commented Aug 31, 2007

Imported From: https://issues.scala-lang.org/browse/SI-38?orig=1
Reporter: @michelou

@scabug
Copy link
Author

scabug commented Nov 6, 2007

@dubochet said:
Modified comparator as requested by submitter.

@scabug
Copy link
Author

scabug commented Jan 14, 2009

@odersky said:
Milestone 2.6.1 deleted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants