sound_rs v0.4.2

10 · Reference

Benchmarks

Historical 0.3.0 measurements with the method next to them, including rows where the library is slower. These device measurements were not rerun during the current headless engineering validation and are not performance guarantees.

Method

Scoreboard

Axissound_rsCompetitorRatio
Import, cold process1.1 ms31.8 ms (soundfile)29×
Metadata, 60 s file1.2 ms31.7 ms26×
Decode WAV130 ms157 ms1.2×
Decode FLAC265 ms455 ms1.7×
Decode MP3241 ms268 ms1.1×
Decode AAC349 msnot supported—
Time to first sound, 10 min11.3 ms302 ms27×
Peak RSS, 10 min file43 MB256 MB6×
Playback overhead, 3 s tone30 ms241 ms8×
Batch decode, 2 FLAC files177 ms299 ms1.7×

Decode detail

60 seconds of stereo 44.1 kHz, median and p95 over seven runs.

Formatsound_rslibsndfilePCM check
WAV 16-bit131 / 160 ms155 msidentical
FLAC265 / 267 ms465 msidentical
MP3241 / 249 ms268 ms1.6·10⁻⁵, 47 samples offset
M4A (AAC)361 / 365 msunsupported8·10⁻⁸ vs ffmpeg

Playback and memory

First soundPeak RSSOverhead
sound_rs Player, 10 min stream11.3 ms43 MB+30 ms
soundfile + sounddevice302 ms256 MB+241 ms

The playback overhead row is a 3-second tone: wall clock minus the track duration. The player number uses a stream that is already open; the one-shot play_array pays the device setup and lands around +180 ms.

Reproduce it

python bench/run.py                 # sound_rs only
python bench/run.py --compare       # + soundfile / sounddevice
python bench/run.py --reps 9

The harness generates its corpus (3 s and 10 min, WAV plus MP3/FLAC/M4A when ffmpeg is available), runs each measurement in a subprocess, and prints median, p95 and peak RSS. A full run takes about three minutes on the machine above.

Where it loses