fengalin / media-toc

Build a table of contents from a media file or split a media file into chapters
MIT License
73 stars 3 forks source link

Try different approaches to lower CPU pressure for AudioBuffer & WaveformImage rendering #142

Closed fengalin closed 5 years ago

fengalin commented 5 years ago

Here are the identified approaches:

Thanks to the recent addition of benches, we can now verify the gains from these approaches.

fengalin commented 5 years ago

Before any changes:

test bench_append_samples ... bench:       4,660 ns/iter (+/- 30)
test bench_render_buffers ... bench:  20,699,294 ns/iter (+/- 656,395)
fengalin commented 5 years ago

Storage as i16:

test bench_append_samples ... bench:       4,669 ns/iter (+/- 20)
test bench_render_buffers ... bench:  18,788,012 ns/iter (+/- 1,398,147)
fengalin commented 5 years ago

Storing samples a SmallVecs of channels:

test bench_append_samples ... bench:       4,346 ns/iter (+/- 42)
test bench_render_buffers ... bench:  18,975,297 ns/iter (+/- 1,482,715)
fengalin commented 5 years ago

Drawing each channel completely:

test bench_append_samples ... bench:       4,674 ns/iter (+/- 84)
test bench_render_buffers ... bench:  12,478,807 ns/iter (+/- 423,996)