-
Notifications
You must be signed in to change notification settings - Fork 12
String: optimize String.format() performance #107
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
base: jdk17u-target8
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This pull request introduces a comprehensive implementation of formatting infrastructure to optimize String.format() performance. The changes add core Java formatting capabilities including a full Formatter class implementation, the Integer class with parsing/formatting methods, and a new String.repeat() method.
Changes:
- Adds complete
Formatterclass (~5400 lines) for printf-style formatting - Implements
Integerclass with string conversion and parsing utilities - Introduces
String.repeat()method for efficient string repetition - Adds new exception classes:
IllegalFormatArgumentIndexExceptionandNumberFormatException
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| IllegalFormatArgumentIndexException.java | New exception for invalid format argument indices |
| Formatter.java | Complete formatter implementation with extensive documentation |
| String.java | Added repeat() method for string repetition |
| NumberFormatException.java | Exception class with factory methods for parsing errors |
| Integer.java | Integer wrapper class with conversion and parsing methods |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| /** | ||
| * Constructs an instance of this class with the specified argument index | ||
| * @param index The value of a corresponding illegal argument index. |
Copilot
AI
Jan 10, 2026
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.
Missing period at the end of the parameter description. The Javadoc should read "The value of a corresponding illegal argument index." to maintain consistency with Java documentation standards.
| assert (shiftDistance >= 1 && shiftDistance < DoubleConsts.SIGNIFICAND_WIDTH); | ||
|
|
||
| long doppel = Double.doubleToLongBits(d); | ||
| // Deterime the number of bits to keep. |
Copilot
AI
Jan 10, 2026
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.
Typo in Javadoc comment. "Deterime" should be spelled "Determine".
| // Deterime the number of bits to keep. | |
| // Determine the number of bits to keep. |
6a9d02d to
3cdcae4
Compare
No description provided.