Eric Wong <normalper...@yhbt.net> writes:

> Måns Rullgård <m...@mansr.com> wrote:
>> Eric Wong <normalper...@yhbt.net> writes:
>> 
>> > Eric Wong <normalper...@yhbt.net> wrote:
>> >> All relevant audio file formats store data sequentially, so
>> >> give a hint to the kernel to perform more readahead.  In current
>> >> Linux, the readahead hint doubles readahead pages and can help
>> >> with playback on slow devices.
>> >
>> > Btw, I've been running this for a few years, too; but pretty
>> > much all on FLAC.
>> >
>> > I don't know if there's audio formats we support which aren't
>> > sequential.  Maybe there's some wacky audio format which
>> > requires random read all over the place...
>> 
>> I can't think of any format that isn't mostly sequential, certainly not
>> that's supported in SoX.  There might exist some format that separates
>> channel data such that reading sequentially from multiple starting
>> points is the best strategy.
>
> Yeah, I was wondering about something along those lines,
> especially if exceeding 2 channels...

I know of formats that interleave channel data in blocks of a few
kilobytes, but those don't require seeking.  Some MOV/MP4 video files
store the video and audio completely separately, but we don't care about
those.

>> What sort of improvement do you get from this anyway?  I'm not opposed
>> to the addition, just curious.
>
> I didn't measure before :x  It's more of a "it couldn't hurt"
> thing and let the kernel (and configured per-device readahead)
> decide.  It's only intended as a hint for the kernel, after all.
>
> My 7200 RPM HDD has 256 MB cache on it; I couldn't measure any
> difference even with 'echo 3 >/proc/sys/vm/drop_caches' (Linux)
> and reading ~300 MB of stuff before testing in hopes it'd clear
> the internal HDD cache.  Maybe slower mounts (optical storage,
> 4200 RPM HDDs, or network FSes) will see the benefit.
>
> I used to play audio on a laptop using an sshfs mount back in
> the day (with FUSE readahead, too), but haven't had the need or
> ability to do that for years, now.

Hmm, I prefer not to add code like this on a hunch.  Maybe I'll hook up
some horrible old laptop drive and see if it makes a difference there.
Then again, does anyone care?

-- 
Måns Rullgård


_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel

Reply via email to