Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(merkle): optimize hashing by reusing sha256 in a pool #44

Commits on Feb 29, 2024

  1. merkle: optimize hashing by reusing sha256 in a pool

    This change optimizes SHA256 hashing for leafHash & innerHash
    by pooling and reusing hashes, which massively reduces on RAM
    consumption and even CPU time (benchmarking on my noisy machine
    is skewed but the results can be verified individually) producing
    the results below:
    
    ```shell
    $ benchstat before.txt after.txt
    name                          old time/op    new time/op    delta
    HashAlternatives/recursive-8    77.6µs ± 2%    77.0µs ± 2%     ~     (p=0.165 n=10+10)
    HashAlternatives/iterative-8    76.3µs ± 1%    76.2µs ± 3%     ~     (p=0.720 n=9+10)
    
    name                          old alloc/op   new alloc/op   delta
    HashAlternatives/recursive-8    25.4kB ± 0%     6.4kB ± 0%  -74.94%  (p=0.000 n=10+10)
    HashAlternatives/iterative-8    28.1kB ± 0%     9.1kB ± 0%  -67.78%  (p=0.000 n=10+10)
    
    name                          old allocs/op  new allocs/op  delta
    HashAlternatives/recursive-8       497 ± 0%       199 ± 0%  -59.96%  (p=0.000 n=10+10)
    HashAlternatives/iterative-8       498 ± 0%       200 ± 0%  -59.84%  (p=0.000 n=10+10)
    ```
    
    Fixes celestiaorg#43
    odeke-em committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    af9405a View commit details
    Browse the repository at this point in the history

Commits on Mar 1, 2024

  1. Configuration menu
    Copy the full SHA
    d63981f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9b27f68 View commit details
    Browse the repository at this point in the history

Commits on Mar 6, 2024

  1. Configuration menu
    Copy the full SHA
    d410907 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e78f1b4 View commit details
    Browse the repository at this point in the history