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

blockchain: Add ancestor optimization to finding Ancestor #1688

Merged
merged 1 commit into from
Dec 7, 2023

Commits on Nov 17, 2023

  1. blockchain: better Ancestor with skiplists

    On startup, Ancestor call was taking a lot of time when the node was
    loading the blockindex onto memory. This change speeds up the Ancestor
    function significantly and speeds up the node during startup.
    
    On testnet3 at blockheight ~2,500,000, the startup was around 30seconds
    on current main and was 5 seconds with this change. Below is a benchstat
    result showing the significant speedup.
    
    goos: darwin
    goarch: arm64
    pkg: github.com/utreexo/utreexod/blockchain
               │     old.txt      │               new.txt                │
               │      sec/op      │    sec/op     vs base                │
    Ancestor-8   120819.301µ ± 5%   7.013µ ± 19%  -99.99% (p=0.000 n=10)
    
               │  old.txt   │            new.txt             │
               │    B/op    │    B/op     vs base            │
    Ancestor-8   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=10) ¹
    ¹ all samples are equal
    
               │  old.txt   │            new.txt             │
               │ allocs/op  │ allocs/op   vs base            │
    Ancestor-8   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=10) ¹
    ¹ all samples are equal
    kcalvinalvin committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    f396b3d View commit details
    Browse the repository at this point in the history