-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8315585: Optimization for decimal to string #23310
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
Draft
wenshao
wants to merge
33
commits into
openjdk:master
Choose a base branch
from
wenshao:dec_to_str_202501
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
4040d76
add benchmark
wenshao 635882f
optimize toString/toPlainString
wenshao 7ed19c8
optimize scale2
wenshao 7b82f78
static scale2
wenshao edffa0f
optimize scale2 int
wenshao 72ed1b7
bug fix
wenshao cb6786b
bug fix
wenshao 57cc7b2
code style
wenshao 0d2b3aa
use getBytes & JLA instead of StringBuilder
wenshao 4a857cf
code style
wenshao 057d006
code style
wenshao a41a34b
revert use StringBuilder
wenshao a734f61
from @j3graham
wenshao 3ed3354
intCompact getValueString & int scale2
wenshao d99a963
remove unnecessary abs
wenshao ddc2a86
simplify scale2
wenshao d78b07c
Revert "simplify scale2"
wenshao 4ee8837
refactor
wenshao 36602df
bug fix
wenshao dc47c78
bug fix
wenshao 3842e35
revert change
wenshao 7d48ac1
code style
wenshao 0a66197
simplify
wenshao dd14ca2
simplify
wenshao cb88e0e
simplify and comments
wenshao cf43f34
Merge remote-tracking branch 'upstream/master' into dec_to_str_202501
wenshao 0e7b30b
copyright
wenshao cf67d84
remove getChars(long, int, char[])
wenshao f9af0b0
Merge remote-tracking branch 'upstream/master' into dec_to_str_202501
wenshao a5a07ce
Merge remote-tracking branch 'upstream/master' into dec_to_str_202501
wenshao b4c142d
Merge remote-tracking branch 'upstream/master' into dec_to_str_202501
wenshao 3c3b740
Merge remote-tracking branch 'upstream/master' into dec_to_str_202501
d7e2934
Refactor BigDecimal string creation to use JLA.uncheckedNewStringWith…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Something to experiment with here:
C2 seems to be able to optimize out the SB here, so it might do as well as
newStringNoRepl.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.
Good suggestion, but DecimalDigits no longer provides a pair method
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.
Right - you’d need to add it back to try this
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.
I tested it on a MacBook M1 Max machine and the results were different from what you said. Using StringBuilder + digitPair would degrade performance.