|
Posted by Andrew Poelstra on 07/11/06 15:12
On 2006-07-11, Tony Marston <tony@NOSPAM.demon.co.uk> wrote:
>
> "David Haynes" <david.haynes2@sympatico.ca> wrote in message
> news:UXKsg.93009$NG4.13289@fe08.usenetserver.com...
>> Tony Marston wrote:
>>> I personally put the text for each language into a separate file, then
>>> load that file into memory at the start of each script. Each individual
>>> string is therefore taken from memory. Because there is only one disk I/O
>>> for the whole file, not each piece of text, it is very fast.
>>
>> Wouldn't the number of disk I/Os depend on the size of the file and the
>> size of the read buffer in the device driver?
>
> Stop being pedantic. I'm talking about reading in the whole file into memory
> in one operation instead of doing a separate read for each piece of text. So
> in my code I perform a single read operation - how the operating system or
> file system handles this, such as splitting the operation into several disk
> accesses, or even retrieving from memory without accessing the disk at all,
> is largely irrelevant.
>
That's not pedantic; reading the whole file takes at least as much memory
as the file is big. If you have a 4Kb disk cache, a 16Kb file will require
4 reads throughout the read instead of... 4 immediately. If your page is
in high demand, saving 75% of memory isn't a minor accomplishment.
--
Andrew Poelstra <http://www.wpsoftware.net/projects/>
To email me, use "apoelstra" at the above domain.
"You people hate mathematics." -- James Harris
Navigation:
[Reply to this message]
|