sound_rs v0.2.1

10 · Reference

Benchmarks

Numbers with the method next to them, including the rows where the library is slower.

Method

Scoreboard

Axissound_rsCompetitorRatio
Import, cold process1.1 ms31.8 ms (soundfile)29×
Metadata, 60 s file1.2 ms31.7 ms26×
Decode WAV131 ms155 ms1.2×
Decode FLAC265 ms465 ms1.8×
Decode MP3247 ms272 ms1.1×
Decode AAC361 msnot supported—
Time to first sound, 10 min8.8 ms492 ms56×
Peak RSS, 10 min file43 MB255 MB6×
Playback overhead, 3 s tone32 ms148 ms4.6×
Batch decode, 2 FLAC files272 ms448 ms1.6×

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
MP3247 / 249 ms272 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 stream8.8 ms43 MB+32 ms
soundfile + sounddevice492 ms255 MB+148 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