Skip to content

chore: use generic btree implementation - #380

Open
thaJeztah wants to merge 2 commits into
hashicorp:masterfrom
thaJeztah:gtree
Open

thaJeztah wants to merge 2 commits into
hashicorp:masterfrom
thaJeztah:gtree

Conversation

@thaJeztah

Copy link
Copy Markdown
Contributor

Update TransmitLimitedQueue to the generic BTreeG implementation that was added in google/btree v1.1.0. This allows using *limitedBroadcast directly without needing conversion to simplify the code.

Description

Update TransmitLimitedQueue to the generic BTreeG implementation that was added in google/btree v1.1.0. This allows using *limitedBroadcast directly without needing conversion to simplify the code.

Related Issue

How Has This Been Tested?

Contributor Checklist

  • LLM Usage If an LLM was used to generate any code, please ensure and confirm you have read
    and followed the AI usage guide.

@thaJeztah
thaJeztah requested a review from a team as a code owner September 19, 2026 17:44
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Update TransmitLimitedQueue to the generic BTreeG implementation that was
added in google/btree v1.1.0. This allows using *limitedBroadcast directly
without needing conversion to simplify the code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah

Copy link
Copy Markdown
Contributor Author

cc @tgross @mismithhisler - the google/btree module has been archive, so .. perhaps should be swapped for something maintained, but at least this one brings the code up to the modern implementation that it provides 😅

Haven't benchmarked it, but the upstream PR shows some benefits on performance as well; google/btree#45

Added some benchmarks; before/after;

goos: darwin
goarch: arm64
pkg: github.com/hashicorp/memberlist
cpu: Apple M3 Pro
                         │  before.txt  │              after.txt               │
                         │    sec/op    │    sec/op     vs base                │
TransmitLimitedQueueTree   155.7n ±  2%   112.4n ± 10%  -27.79% (p=0.000 n=10)
TransmitLimitedQueueWalk   3.515µ ± 16%   3.168µ ±  2%   -9.87% (p=0.000 n=10)
geomean                    739.7n         596.7n        -19.33%

                         │  before.txt  │                after.txt                │
                         │     B/op     │    B/op     vs base                     │
TransmitLimitedQueueTree   0.000 ± 0%     0.000 ± 0%         ~ (p=1.000 n=10) ¹
TransmitLimitedQueueWalk   16.00 ± 0%      0.00 ± 0%  -100.00% (p=0.000 n=10)
geomean                               ²               ?                       ² ³
¹ all samples are equal
² summaries must be >0 to compute geomean
³ ratios must be >0 to compute geomean

                         │  before.txt  │                after.txt                │
                         │  allocs/op   │ allocs/op   vs base                     │
TransmitLimitedQueueTree   0.000 ± 0%     0.000 ± 0%         ~ (p=1.000 n=10) ¹
TransmitLimitedQueueWalk   1.000 ± 0%     0.000 ± 0%  -100.00% (p=0.000 n=10)
geomean                               ²               ?                       ² ³
¹ all samples are equal
² summaries must be >0 to compute geomean
³ ratios must be >0 to compute geomean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant