-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] formats: performance of
splitNumber()
To compute the formatted value of a number, we need to split it into its integer digits and decimal digits. This was done by the function `splitNumber()`, which was using Intl.NumberFormat, which handles everything for us, but is quite slow. Now convert the number to string using Number.toString(), and handle the max number of decimal and the rounding by hand. We will still use Intl.NumberFormat for numbers too big/small, for which Number.toString() returns an exponential notation. Rough benchmark : Sheet 26 cols x 10.000 rows, using a CF on the whole sheet to force the evaluation of the lazy values. ---------------------- w/ sheet filled with integers: old: splitNumber ~299ms new: splitNumber ~9.5ms w/ sheet filled with floats: Old: splitNumber ~555ms New: splitNumber ~30ms Task: 3272878 Part-of: #2373
- Loading branch information
1 parent
dd322bb
commit a02ed72
Showing
3 changed files
with
110 additions
and
6 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
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