Rockbox mail archiveSubject: Re: A nasty inefficieny in file.c?
Re: A nasty inefficieny in file.c?
From: Jens Arnold <arnold-j_at_t-online.de>
Date: Fri, 14 Jul 2006 08:06:22 +0200
On 14.07.2006, postmaster_at_diffenbach.org wrote:
> Jens Arnold wrote:
>> For this purpose, file.c caches up to one sector worth of
>> data. "headbytes" is any new data that fits into the sector
>> cache when it's already dirty.
> That implies thst the file is being /written/ to disk? What's
> being written when I'm just listening to music?
Hmm, my description was a little imprecise. readwrite() is
used for both reading and writing, that's why it's called
"readwrite()". It divides every file access in 3 parts:
(1) Head bytes. These are any bytes copied to / from the
sector cache when the cache already contains something.
When the sector cache becomes full / completely used, it
is marked empty (after flushing to disk for writing).
(2) Whole sectors. These are written to / read from disk
without extra caching.
(3) Tail bytes. These are any leftover bytes which don't fill
up a whole sector, and are copied to / from the sector
cache (after filling the cache from disk for reading).
So, if a file is read or written in single-byte calls, there'll
be 1x one tail byte and 511x one head byte for each 512 bytes of
data. Very inefficient.
Received on 2006-07-14
Page was last modified "Sat May 23 08:12:40 2020" The Rockbox Crew