Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Fix and improve benchmarks #92

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

aminya
Copy link
Contributor

@aminya aminya commented Dec 8, 2020

Description of the change

This fixes all the benchmarks that were broken before this.

  • this includes large-buffer-text and text-buffer benchmarks
  • Now, a new csv large file is downloaded from a new link (the old file is not available anymore).
  • uses download package instead of non-working unzip package
  • makes the test runners async
  • runs the tests for different words
  • add buffer.setText benchmarks
  • uses performance from perf_hooks to measure the time accurately
  • pretty print the results

Running this benchmark on my master branch that includes all the improvements from other PRs shows that it is ~30 faster compared to the latest official superstring 🚀
https://github.com/aminya/superstring

Verifications

npm install
npm run benchmark

Sample output:


 running text-buffer tests...

Search for simple non-existent pattern - TextBuffer                               26.355 ms
Search for simple non-existent pattern - lines array                              230.589 ms
Search for complex non-existent pattern - TextBuffer                              142.064 ms
Search for complex non-existent pattern - lines array                             214.708 ms
Search for simple existing pattern - TextBuffer                                   0.732 ms
Search for simple existing pattern - lines array                                  0.122 ms
Search for complex existing pattern - TextBuffer                                  0.378 ms
Search for complex existing pattern - lines array                                 0.141 ms

 text-buffer finished

 running marker-index tests...

sequential inserts                                                                115.662 ms
inserts                                                                           154.717 ms
range queries                                                                     1206.237 ms
splices                                                                           8229.161 ms
deletes                                                                           5.935 ms

 marker-index finished


 running large-text-buffer tests...

For 100b file, buffer.setText took                                                 0.06480 ms
For 100b file, time to find "Morocco" was:                                         0.66360 ms
For 100b file, time to find "Austria" was:                                         0.16340 ms
For 100b file, time to find "France" was:                                          0.09890 ms
For 100b file, time to find "Liechtenstein" was:                                   0.07530 ms
For 100b file, time to find "Republic of the Congo" was:                           0.07960 ms
For 100b file, time to find "Antigua and Barbuda" was:                             0.07610 ms
For 100b file, time to find "Japan" was:                                           0.07120 ms


For 1kb file, buffer.setText took                                                  0.05190 ms
For 1kb file, time to find "Morocco" was:                                          0.74130 ms
For 1kb file, time to find "Austria" was:                                          0.17100 ms
For 1kb file, time to find "France" was:                                           0.10220 ms
For 1kb file, time to find "Liechtenstein" was:                                    0.10360 ms
For 1kb file, time to find "Republic of the Congo" was:                            0.10850 ms
For 1kb file, time to find "Antigua and Barbuda" was:                              0.13240 ms
For 1kb file, time to find "Japan" was:                                            0.10670 ms


For 1MB file, buffer.setText took                                                  2.60130 ms
For 1MB file, time to find "Morocco" was:                                          10.84790 ms
For 1MB file, time to find "Austria" was:                                          11.30790 ms
For 1MB file, time to find "France" was:                                           12.05650 ms
For 1MB file, time to find "Liechtenstein" was:                                    10.46920 ms
For 1MB file, time to find "Republic of the Congo" was:                            10.88970 ms
For 1MB file, time to find "Antigua and Barbuda" was:                              10.42880 ms
For 1MB file, time to find "Japan" was:                                            11.04220 ms


For 51MB file, buffer.setText took                                                 238.71440 ms
For 51MB file, time to find "Morocco" was:                                         1061.28110 ms
For 51MB file, time to find "Austria" was:                                         1172.22850 ms
For 51MB file, time to find "France" was:                                          1057.88760 ms
For 51MB file, time to find "Liechtenstein" was:                                   997.99980 ms
For 51MB file, time to find "Republic of the Congo" was:                           1018.14570 ms
For 51MB file, time to find "Antigua and Barbuda" was:                             1047.52090 ms
For 51MB file, time to find "Japan" was:                                           1069.09540 ms


For 119MB file, buffer.setText took                                                326.30900 ms
For 119MB file, time to find "Morocco" was:                                        1352.57120 ms
For 119MB file, time to find "Austria" was:                                        1371.68760 ms
For 119MB file, time to find "France" was:                                         1391.56260 ms
For 119MB file, time to find "Liechtenstein" was:                                  1303.91920 ms
For 119MB file, time to find "Republic of the Congo" was:                          1295.11590 ms
For 119MB file, time to find "Antigua and Barbuda" was:                            1289.58380 ms
For 119MB file, time to find "Japan" was:                                          1324.39010 ms


 large-text-buffer finished

Release Notes

N/A

@aminya aminya changed the title Fix large-text-buffer benchmarks Fix large-text-buffer and text-buffer benchmarks Dec 8, 2020
@aminya aminya changed the title Fix large-text-buffer and text-buffer benchmarks Fix and improve benchmarks Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant