helium / blockchain-core

Apache License 2.0
214 stars 85 forks source link

Attempt to optimize updating the h3dex targeting indices #1409

Closed Vagabond closed 2 years ago

PaulVMo commented 2 years ago

Looks good to me - I have it running on a follower and forced the random hex lookup to be built/maintained by changing the poc_targeting_verison checks in these functions to >=4. It is following the chain just fine and shows a ~25x savings by using the new add/remove hex to random lookup functions versus using the build_random_targeting_hex_lookup every time a new targeting hexes is added or removed.

2022-06-29 20:58:46.831 [info] <0.3977.0>@blockchain_ledger_v1:build_random_hex_targeting_lookup:{5160,13} build_random_hex_targeting_lookup in 7619 ms
2022-06-29 21:03:20.950 [info] <0.1958.0>@blockchain_ledger_v1:add_hex_to_random_lookup:{5122,12} add_hex_to_random_lookup in 219 ms
2022-06-29 21:03:38.490 [info] <0.1958.0>@blockchain_ledger_v1:add_hex_to_random_lookup:{5122,12} add_hex_to_random_lookup in 279 ms
2022-06-29 21:03:56.840 [info] <0.1958.0>@blockchain_ledger_v1:add_hex_to_random_lookup:{5122,12} add_hex_to_random_lookup in 252 ms
2022-06-29 21:04:17.332 [info] <0.1958.0>@blockchain_ledger_v1:add_hex_to_random_lookup:{5122,12} add_hex_to_random_lookup in 320 ms
2022-06-29 21:04:20.153 [info] <0.6980.0>@blockchain_ledger_v1:build_random_hex_targeting_lookup:{5160,13} build_random_hex_targeting_lookup in 6415 ms