diff --git a/orga/performance-trackings.md b/orga/performance-trackings.md index d599dd25615..05a75d7d2f0 100644 --- a/orga/performance-trackings.md +++ b/orga/performance-trackings.md @@ -1338,3 +1338,19 @@ compareCounts: 1431962 AFTER (using custom low index): time for "merge sorted arrays": 847.3687120079994ms compareCounts: 1261729 + + +## Improve getIndexableStringMonad()() + +BEFORE: +91.24348497390747 +86.09021002054214 +89.61336600780487 +87.5959959924221 +87.1041649878025 + + +AFTER (fix getNumberIndexString()): +76.63579297065735 +63.062547981739044 +80.47493699193001 diff --git a/src/custom-index.ts b/src/custom-index.ts index aacfc529c46..0cb683ea36d 100644 --- a/src/custom-index.ts +++ b/src/custom-index.ts @@ -206,14 +206,12 @@ export function getNumberIndexString( fieldValue = parsedLengths.maximum; } - let str: string = ''; const nonDecimalsValueAsString = (Math.floor(fieldValue) - parsedLengths.roundedMinimum).toString(); - str += nonDecimalsValueAsString.padStart(parsedLengths.nonDecimals, '0'); - - const splitByDecimalPoint = fieldValue.toString().split('.'); - const decimalValueAsString = splitByDecimalPoint.length > 1 ? splitByDecimalPoint[1] : '0'; + let str = nonDecimalsValueAsString.padStart(parsedLengths.nonDecimals, '0'); if (parsedLengths.decimals > 0) { + const splitByDecimalPoint = fieldValue.toString().split('.'); + const decimalValueAsString = splitByDecimalPoint.length > 1 ? splitByDecimalPoint[1] : '0'; str += decimalValueAsString.padEnd(parsedLengths.decimals, '0'); } return str;