Skip to content

Conversation

@max-dfinity
Copy link
Contributor

@max-dfinity max-dfinity commented Oct 14, 2024

When scanning neurons in the main StableBTreeMap, instead of doing a separate traversal of the auxiliary StableBTreeMaps for EACH neuron in the result set, ranges of each auxiliary StableBTreeMap are used (and scanned in parallel).

This gets around a 40% performance improvement.

This method, while not currently extensively used, will be used more after the migration of neurons to stable storage.

Benchmark results before the change:

// Output from benchmark test
Benchmark: range_neurons_performance
  total:
    instructions: 47.07 M (improved by 41.47%)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

range_neurons_performance:
  total:
    instructions: 80415437
    heap_increase: 0
    stable_memory_increase: 0
  scopes: {}

After the change (what's in PR):

  range_neurons_performance:
    total:
      instructions: 47070657
      heap_increase: 0
      stable_memory_increase: 0
    scopes: {}

@max-dfinity max-dfinity marked this pull request as ready for review October 14, 2024 23:50
@max-dfinity max-dfinity requested a review from a team as a code owner October 14, 2024 23:50
@daniel-wong-dfinity-org
Copy link
Contributor

the performance characteristics of StableBTreeMap

What is this? The description should explain.

Copy link
Contributor

@daniel-wong-dfinity-org daniel-wong-dfinity-org left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@max-dfinity max-dfinity force-pushed the improve_range_neurons branch from 8b982c9 to f58431b Compare October 15, 2024 19:12
@max-dfinity max-dfinity force-pushed the improve_range_neurons branch from ab164f1 to c624422 Compare October 15, 2024 21:44
@max-dfinity max-dfinity enabled auto-merge October 15, 2024 21:45
@max-dfinity max-dfinity added this pull request to the merge queue Oct 15, 2024
Merged via the queue into master with commit 4bd8e1d Oct 15, 2024
@max-dfinity max-dfinity deleted the improve_range_neurons branch October 15, 2024 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants