[experiment] force chunking when using dynamic sources
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 12/100
- Issue type
- Refactor
- Clarity
- Needs clarification
- Activity status
- Quiet
- Tech stack
- rust
- Domain
- audio-video-rtc, performance
Research direction
The payload names no files, only the mixer's Box<dyn Source> storage and a sketched Chunked wrapper with a next method on Mixer. Start by finding where the mixer boxes its sources and how next() pulls samples, then benchmark the current path. Done would mean a measured comparison with a proposed design agreed in the thread, which is not yet settled.
Written by the indexing model from the issue text.
Description
I suspect one thing that can really slow the mixer down is that it takes Box<dyn Source>. Since the next() calls cannot be inlined here this probably slows everything down. We can make this less of an issue by getting chunks (up to some size) in the mixer. Roughly:
impl source -> Sample
chunked(impl source) -> [Sample] // returns array
Box<dyn chunked> -> [Sample] // return array
Mixer() -> Sample (uses the chunks internally)
Now the only way to get a nice API with this is to hide the whole chunking inside the mixer. Like this:
struct Mixer {...}
impl Mixer {
fn add(&mut self, s: impl Source) {
let chunked = Chunked::from(s);
let chunked = Box::new(chunked) as Box<dyn Chunk>;
self.sources.push(chunked)
}
...
}
impl Iterator for Mixer {
fn next(&mut self) -> Option<Sample> {
if self.cached_chunks.is_empty() {
for chunked in self.sources {
self.cached_chunks.push(chunked.next_chunk())?;
}
}
let mut sample = 0.0;
for chunk in &mut self.cached_chunks {
sample += chunk.pop_front();
}
Some(sample)
}
}
- Dominant language
- Rust
- Stars
- 2.5k
- Forks
- 338
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from RustAudio/rodio
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 1/5 Under an hour Newbie friendliness 73/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 67/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
ci: migrate pinned macos-15 runners to macos-26 and macos-26-intelPossibly taken @hawkingrei claimed this today. Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
nowledge-co/hawdb#2224 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
eclipse-score/coverage_tool#95 ·
Maintainers usually reply within 2 days
-
bug nvim
Difficulty 2/5 1-3 hours Newbie friendliness 74/100