Repository navigation
feat: prefetch the next block while scrolling SpikeInterface traces - #1
Closed
galenlynch wants to merge 1 commit into
Closed
galenlynch wants to merge 1 commit into
galenlynch wants to merge 1 commit into
Conversation
Scrolling a remote or preprocessed recording stalls each time the window enters a block not yet computed. A read that continues the previous one now starts computing the next block in the direction of travel on a background thread. Reads that jump, such as waveform snippets, prefetch nothing and cancel pending prefetches, so random access does no extra work, and a requested block is computed in the calling thread rather than queued behind prefetches. A failed prefetch is dropped, so it does not make its block unreadable. close() stops the thread pool. benchmarks/benchmark_spikeinterface_reader.py, 384 channels at 30 kHz with 0.2 s latency plus 0.5 s per second of data per call: pattern prefetch total mean read reads > 0.1 s get_traces scroll off 13.78s 0.038s 6 6 scroll on 11.44s 0.014s 1 7 snippets off 47.38s 0.474s 100 102 snippets on 46.89s 0.469s 100 102 Scrolling is 100 steps of 10% of a 0.25 s window with 0.1 s pauses; the one slow read left is the first. Snippets are 100 reads of 82 samples.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds on cortex-lab#68. With the SpikeInterface reader, scrolling the trace view stalls each time the window reaches a block that hasn't been computed yet. This computes the next block on a background thread while you scroll, so most steps are served from the cache.
Prefetch only happens when a read continues the previous one, and only in the direction of travel. Any other read, like a waveform snippet, cancels pending prefetches and prefetches nothing, so random access does no extra work. A requested block is never queued behind a prefetch, and a failed prefetch is dropped rather than cached.
close()stops the thread. Passprefetch=Falseto turn itoff.
benchmarks/benchmark_spikeinterface_reader.pyuses a fake recording that takes 0.2 s plus 0.5 s per second of data on each call. Scrolling 100 steps goes from 13.8 s to 11.4 s, with one slow read instead of six. 100 random snippet reads take the same time with and without prefetch.