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

Use java.lang.Long.bitCount in BitSetFactory #2196

Closed
scabug opened this issue Jul 25, 2009 · 4 comments
Closed

Use java.lang.Long.bitCount in BitSetFactory #2196

scabug opened this issue Jul 25, 2009 · 4 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Jul 25, 2009

Long.bitCount and Integer.bitCount use bit folding to make this computation fast. In addition to that Hotspot knows these methods and can replace them with native opcode if the CPU supports them (JDK7).

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jul 25, 2009

Imported From: https://issues.scala-lang.org/browse/SI-2196?orig=1
Reporter: Matthias Mann (matthiasmann)
Attachments:

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Mar 14, 2011

@soc said:
The affected code is now (2.9 trunk) located in scala/collection/BitSetLike.scala.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Dec 2, 2011

@szeiger said:
Almost 10x performance improvement on Java 7 x64:

C:\Users\szeiger\Desktop>scala BitCountPerformance
bitCount: 637ms -> 1962026240
popCount: 5242ms -> 1962026240

C:\Users\szeiger\Desktop>java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Dec 2, 2011

@soc said:
Fixed in scala/scala@989c0d0.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.