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

implement sync CoveredNetworksWalk with callback #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

themiron
Copy link

@themiron themiron commented Oct 2, 2024

It's useful for cases where walk needs to stop after Nth found network w/o traversing the whole network list.
Accodrding bench, it's even faster than current goroutine-based variant:

  Benchmark_CoveredNetworksAsync/IPTrie-12   2  829524748 ns/op  10000 batch_size
  Benchmark_CoveredNetworksSync/IPTrie-12   91   13892012 ns/op  10000 batch_size

With stop after the first found, it's obviously faster too:

  Benchmark_CoveredNetworksAsync/IPTrie-12  2        804893434 ns/op  10000 batch_size
  Benchmark_CoveredNetworksSync/IPTrie-12   2740110  443.1 ns/op      10000 batch_size

It's useful for cases where walk needs to stop after Nth found network
w/o traversing the whole network list.
Accodrding bench, it's even faster than current goroutine-based variant:

  Benchmark_CoveredNetworksAsync/IPTrie-12   2  829524748 ns/op  10000 batch_size
  Benchmark_CoveredNetworksSync/IPTrie-12   91   13892012 ns/op  10000 batch_size

With stop after the first found, it's obviously faster too:

  Benchmark_CoveredNetworksAsync/IPTrie-12  2        804893434 ns/op  10000 batch_size
  Benchmark_CoveredNetworksSync/IPTrie-12   2740110  443.1 ns/op      10000 batch_size
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