Skip to content

Latest commit

 

History

History
132 lines (119 loc) · 6.77 KB

benchmark.md

File metadata and controls

132 lines (119 loc) · 6.77 KB

benchmark output as a table

Compares performance of version 1.1.0 versus 2.0.0 measured by BenchmarkJS.

  1. input - the input provided to each implementation
  2. old - the previous version, 1.1.0
  3. new - the current version, 2.0.0
  4. '+' - the change from 'old' to 'new' ((new - old) / old)

(I used the names 'old' and 'new' because they're the same length for the console output during run which prints as each one completes).

Run this for yourself via:

git clone https://github.com/elidoran/comma-number.git
cd comma-number
npm install
npm run benchmark

I converted the output to a table instead of using a screenshot because:

  1. it's very long
  2. it's better in the repo as text to update than an image file

Table

input old new +
'1' 4,321,660 25,292,907 485%
'12' 2,335,091 25,279,395 983%
'123' 2,215,699 25,280,389 1041%
'1234' 1,898,418 2,717,567 43%
'12345' 1,803,474 2,646,915 47%
'123456' 1,650,963 2,647,299 60%
'1234567' 1,496,245 2,391,898 60%
'12345678' 1,142,649 1,790,405 57%
'123456789' 1,106,347 1,771,035 60%
'1234567890' 1,023,218 1,667,711 63%
'12345678901' 910,813 1,367,909 50%
'123456789012' 867,090 1,365,369 57%
'-1' 2,411,602 25,421,983 954%
'-12' 2,115,630 25,416,782 1101%
'-123' 1,985,855 25,490,377 1184%
'-1234' 1,723,408 2,521,618 46%
'-12345' 1,640,526 2,511,340 53%
'-123456' 1,506,253 2,477,339 64%
'-1234567' 1,379,279 2,218,996 61%
'-12345678' 1,302,015 2,166,128 66%
'-123456789' 1,240,217 2,188,525 76%
'-1234567890' 931,515 1,402,964 51%
'-12345678901' 893,546 1,360,492 52%
'-123456789012' 852,291 1,351,246 59%
1 4,490,943 22,922,986 410%
12 2,407,925 22,823,602 848%
123 2,250,508 22,924,160 919%
1234 1,927,439 2,825,233 47%
12345 1,822,013 2,648,682 45%
123456 1,675,451 2,609,400 56%
1234567 1,515,779 2,467,017 63%
12345678 1,417,092 2,344,859 65%
123456789 1,355,513 2,319,054 71%
1234567890 1,239,985 2,176,519 76%
12345678901 849,303 1,248,418 47%
123456789012 812,314 1,252,207 54%
-1 2,621,460 22,925,704 775%
-12 2,278,395 22,927,460 906%
-123 2,131,312 22,904,668 975%
-1234 1,830,496 2,636,265 44%
-12345 1,741,359 2,599,531 49%
-123456 1,617,002 2,610,976 61%
-1234567 1,457,942 2,319,680 59%
-12345678 1,366,607 2,319,183 70%
-123456789 1,308,331 2,277,656 74%
-1234567890 1,196,768 2,071,324 73%
-12345678901 834,994 1,260,339 51%
-123456789012 792,373 1,251,785 58%
'1.2' 1,490,516 25,353,848 1601%
'12.3' invalid 8,261,296 N/A
'123.4' invalid 7,956,188 N/A
'1234.5' invalid 1,323,602 N/A
'12345.6' invalid 1,311,006 N/A
'123456.7' invalid 1,304,573 N/A
'1234567.8' invalid 1,219,565 N/A
'12345678.9' invalid 1,218,523 N/A
'123456789.0' invalid 1,367,902 N/A
'1234567890.1' invalid 1,262,388 N/A
'12345678901.2' invalid 1,246,678 N/A
'123456789012.3' invalid 1,248,526 N/A
'-1.2' 1,426,902 25,499,637 1687%
'-12.3' invalid 8,251,000 N/A
'-123.4' invalid 8,063,694 N/A
'-1234.5' invalid 1,330,762 N/A
'-12345.6' invalid 1,315,983 N/A
'-123456.7' invalid 1,305,668 N/A
'-1234567.8' invalid 1,227,211 N/A
'-12345678.9' invalid 1,349,881 N/A
'-123456789.0' invalid 1,363,914 N/A
'-1234567890.1' invalid 1,248,929 N/A
'-12345678901.2' invalid 1,244,452 N/A
'-123456789012.3' invalid 1,234,068 N/A
1.2 1,269,245 4,818,785 280%
12.3 invalid 4,654,728 N/A
123.4 invalid 4,822,503 N/A
1234.5 invalid 1,175,543 N/A
12345.6 invalid 1,195,957 N/A
123456.7 invalid 1,194,760 N/A
1234567.8 invalid 1,112,158 N/A
12345678.9 invalid 1,126,245 N/A
123456789.1 invalid 1,255,677 N/A
1234567890.1 invalid 1,165,026 N/A
12345678901.2 invalid 1,189,248 N/A
123456789012.3 invalid 1,171,412 N/A
-1.2 1,225,972 4,839,886 295%
-12.3 invalid 4,818,502 N/A
-123.4 invalid 4,850,423 N/A
-1234.5 invalid 1,195,494 N/A
-12345.6 invalid 1,193,016 N/A
-123456.7 invalid 1,195,036 N/A
-1234567.8 invalid 1,128,043 N/A
-12345678.9 invalid 1,254,578 N/A
-123456789.1 invalid 1,249,335 N/A
-1234567890.1 invalid 1,173,335 N/A
-12345678901.2 invalid 1,182,431 N/A
-123456789012.3 invalid 1,174,234 N/A

Benchmarking Future

This benchmark script is helpful for comparing new changes to the pre-change version.

It just happens to be starting out as a way to compare the newest major version with the previous one.