-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Have a proper leaf node instead of storing the leaf inside an empty node4. This will reduce memory usage and takes out an allocation and a pointer dereference. For 1M dummy objects the memory usage is ~15% less and the insert speed is ~15% faster, with 30% less allocations. The leaf node is still wasting some space as it shares the header and the 'leaf' and 'prefix' fields could be removed. Before: Benchmark_Insert_RootOnlyWatch-8 4873 213619 ns/op 4681237 objects/sec 148882 B/op 3076 allocs/op Benchmark_Insert-8 4107 267379 ns/op 3740016 objects/sec 249387 B/op 4114 allocs/op Inserting batch 1000/1000 ... Waiting for reconciliation to finish ... 1000000 objects reconciled in 3.10 seconds (batch size 1000) Throughput 322570.39 objects per second Allocated 8012221 objects, 471726kB bytes, 527128kB bytes still in use After: Benchmark_Insert_RootOnlyWatch-8 5898 187664 ns/op 5328686 objects/sec 116722 B/op 2071 allocs/op Benchmark_Insert-8 4978 257483 ns/op 3883746 objects/sec 217225 B/op 3109 allocs/op benchmark % go run . -objects 1000000 Inserting batch 1000/1000 ... Waiting for reconciliation to finish ... 1000000 objects reconciled in 2.73 seconds (batch size 1000) Throughput 365990.20 objects per second Allocated 6011516 objects, 409163kB bytes, 484024kB bytes still in use Signed-off-by: Jussi Maki <[email protected]>
- Loading branch information
Showing
5 changed files
with
102 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters