invertase / denque

The fastest javascript implementation of a double-ended queue. Used by the official Redis, MongoDB, MariaDB & MySQL libraries for Node.js and many other libraries.
https://docs.page/invertase/denque
Apache License 2.0
354 stars 33 forks source link

Additional benchmarks #45

Closed dnlmlr closed 2 years ago

dnlmlr commented 2 years ago

As suggested in #43 I added the growth benchmark.

I also added two other benchmarks that are related to more performance improvments.

The first is an enhanced version of the toArray benchmark. That benchmark does what the name suggests and benchmarks the performance of the toArray function. It also does this for 3 scenarios: When the internal buffer is contiguous, once with the head at index 0 and once with the head not at 0. The last scenario is when the buffer is wrapped (head > tail). On top of that I added an "array to array copy" as a baseline comparison.

The second additional benchmark is the fromArray benchmark which simply creates a Denque from a given array.

I'll make a PR with further improvements to the _fromArray and _copyArray functions which in turn improve the performance in the two additional benchmarks significantly.

codecov[bot] commented 2 years ago

Codecov Report

Merging #45 (9af040b) into master (f400043) will not change coverage. The diff coverage is n/a.

:exclamation: Current head 9af040b differs from pull request most recent head 6c84d44. Consider uploading reports for the commit 6c84d44 to get more accurate results

@@            Coverage Diff            @@
##            master       #45   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          224       224           
  Branches        48        48           
=========================================
  Hits           224       224           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f400043...6c84d44. Read the comment docs.