-
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.
statedb: Use table positions instead of names in txn
WriteTxn() is fairly slow and partially the reason is the heaviness of using hash maps to look up the tables that are being modified. Since the set of tables is static at runtime we can just use integer index to look up. This can later be extended to the indexTxn as well. Before: goos: linux goarch: amd64 pkg: github.com/cilium/statedb cpu: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz BenchmarkDB_WriteTxn_1-8 132523 9268 ns/op 107899 objects/sec BenchmarkDB_WriteTxn_10-8 367114 3044 ns/op 328531 objects/sec BenchmarkDB_WriteTxn_100-8 430207 2459 ns/op 406751 objects/sec BenchmarkDB_WriteTxn_100_SecondaryIndex-8 503071 2358 ns/op 424111 objects/sec BenchmarkDB_RandomInsert-8 945 1288636 ns/op 776014 objects/sec BenchmarkDB_RandomReplace-8 226 5256999 ns/op 190223 objects/sec BenchmarkDB_SequentialInsert-8 370 3580799 ns/op 279267 objects/sec ... BenchmarkDB_DeleteTracker_Baseline-8 356 3314962 ns/op 301663 objects/sec BenchmarkDB_DeleteTracker-8 181 6609844 ns/op 151290 objects/sec BenchmarkDB_RandomLookup-8 3289 354713 ns/op 2819181 objects/sec BenchmarkDB_SequentialLookup-8 3519 334955 ns/op 2985479 objects/sec BenchmarkDB_FullIteration_All-8 88718 12817 ns/op 78022832 objects/sec BenchmarkDB_FullIteration_Get-8 71965 15974 ns/op 62599999 objects/sec BenchmarkDB_PropagationDelay-8 188659 6398 ns/op 55.00 50th_µs 74.00 90th_µs 277.0 99th_µs PASS ok github.com/cilium/statedb 33.132s After: goos: linux goarch: amd64 pkg: github.com/cilium/statedb cpu: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz BenchmarkDB_WriteTxn_1-8 160879 7232 ns/op 138271 objects/sec BenchmarkDB_WriteTxn_10-8 442489 2597 ns/op 385104 objects/sec BenchmarkDB_WriteTxn_100-8 511983 2201 ns/op 454271 objects/sec BenchmarkDB_WriteTxn_100_SecondaryIndex-8 511678 2205 ns/op 453489 objects/sec BenchmarkDB_RandomInsert-8 1045 1134981 ns/op 881072 objects/sec BenchmarkDB_RandomReplace-8 246 4879081 ns/op 204957 objects/sec BenchmarkDB_SequentialInsert-8 387 3108060 ns/op 321744 objects/sec ... BenchmarkDB_DeleteTracker_Baseline-8 374 3167598 ns/op 315697 objects/sec BenchmarkDB_DeleteTracker-8 182 6409534 ns/op 156018 objects/sec BenchmarkDB_RandomLookup-8 3505 317084 ns/op 3153747 objects/sec BenchmarkDB_SequentialLookup-8 3951 293740 ns/op 3404371 objects/sec BenchmarkDB_FullIteration_All-8 98962 12085 ns/op 82749863 objects/sec BenchmarkDB_FullIteration_Get-8 81453 14711 ns/op 67978410 objects/sec BenchmarkDB_PropagationDelay-8 206851 5742 ns/op 50.00 50th_µs 64.00 90th_µs 261.0 99th_µs PASS ok github.com/cilium/statedb 31.966s Signed-off-by: Jussi Maki <[email protected]>
- Loading branch information
Showing
7 changed files
with
136 additions
and
146 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
Oops, something went wrong.