IPB

Welcome Guest ( Log In | Register )

FLAC I/O less efficient than STDIN, Direct file access can be almost twice slower than STDIN
skamp
post Nov 26 2012, 18:26
Post #1





Group: Developer
Posts: 1412
Joined: 4-May 04
From: France
Member No.: 13875



I was optimizing caudec when I came across this oddity. Basically, letting /usr/bin/flac access .flac files on a slowish HDD directly for decoding ('flac -d file.flac') was in one particular case almost twice slower than piping the files to /usr/bin/flac via STDIN ('cat file.flac | flac -d -').

I used a double album for testing, made of 37 tracks for a total of about 1 GiB, located on a HDD that tops out at about 70 MB/s. Incidentally, flac decodes on my machine at a similar rate.

I ran caudec twice (figuratively - I repeated the tests many times) with 8 concurrent processes, for decoding those FLAC files to WAV on a ramdisk. I made sure to drop all caches between each run. First run was with direct file access, and completed in 40 seconds. Second run was with piping to STDIN, and completed in 25 seconds.

The difference was much less pronounced, surprisingly, on a USB flash drive that tops out at 35 MB/s, 34 seconds vs. 30 seconds, and non-existant on a RAID 1 array that tops out at 130 MB/s and on a SSD that tops out at 500 MB/s. I experienced similar differences with WavPack.

Does anyone have any idea of what's going on?


--------------------
See my profile for measurements, tools and recommendations.
Go to the top of the page
+Quote Post
 
Start new topic
Replies
Axon
post Nov 27 2012, 01:32
Post #2





Group: Members (Donating)
Posts: 1984
Joined: 4-January 04
From: Austin, TX
Member No.: 10933



You might try `blockdev --setra 65536 --setfra 65536 <device>` to set blockdev/fs readahead to ridiculously high values.

It's possible that the difference in performance between the HD, USB HD and RAID are primarily due to small I/O timing differences between the processes tickling the pagecache in different ways.
Go to the top of the page
+Quote Post
skamp
post Nov 27 2012, 02:52
Post #3





Group: Developer
Posts: 1412
Joined: 4-May 04
From: France
Member No.: 13875



QUOTE (Axon @ Nov 27 2012, 01:32) *
You might try `blockdev --setra 65536 --setfra 65536 <device>` to set blockdev/fs readahead to ridiculously high values.


Bingo! With those values, the test on the HDD completed in 16 seconds in all cases! All my drives were set to 256 sectors (128 KiB). I noticed that performance improved dramatically when adjusting that value a single step up (512), and 2048 (1 MiB) sounds like a rather sane value.


--------------------
See my profile for measurements, tools and recommendations.
Go to the top of the page
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 28th July 2014 - 14:21