-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve performance of integer formatting (#76726)
* Improve performance of integer formatting 1. The DivRem(..., 10) for each digit in the number ends up being the most expensive aspect of formatting. This employs a trick other formatting libraries use, which is to have a table for all the formatted values between 00 and 99, and to then DivRem(..., 100) to cut the number of operations in half, which for longer values is meaningful. 2. Avoids going through the digit counting path when we know at the call site it won't be needed. 3. Employs a branch-free, table-based lookup for CountDigits(ulong) to go with a similar approach added for uint. * Address PR feedback (move license notice)
- Loading branch information
1 parent
daa88f6
commit 5892ef2
Showing
4 changed files
with
324 additions
and
141 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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.