mirage / irmin

Irmin is a distributed database that follows the same design principles as Git
https://irmin.org
ISC License
1.83k stars 154 forks source link

Optimize Tree.length #2253

Closed art-w closed 1 year ago

art-w commented 1 year ago

The rollups code is using the Tree.length operation in a way that wasn't optimized and resulted in terrible performances:

We can however cache the length! In the end, I went with a lazy incremental solution which seems to bring the most performances for this use case:

(Note that this PR is targeting irmin 3.6 to ease testing in the rollups code -- issue https://github.com/mirage/irmin/issues/2251 )

codecov-commenter commented 1 year ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (3.6@0d241e6). Click here to learn what that means. The diff coverage is n/a.

:exclamation: Current head 4b50581 differs from pull request most recent head ab3edd9. Consider uploading reports for the commit ab3edd9 to get more accurate results

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@          Coverage Diff           @@
##             3.6    #2253   +/-   ##
======================================
  Coverage       ?   68.11%           
======================================
  Files          ?      134           
  Lines          ?    16178           
  Branches       ?        0           
======================================
  Hits           ?    11019           
  Misses         ?     5159           
  Partials       ?        0           

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

art-w commented 1 year ago

Closing in favor of releasing this fix in Irmin 3.7 with #2258