Reply to Re: Writing multilingual site - how to effectively output strings depending on language

Your name:

Reply:


Posted by Tony Marston on 07/12/06 08:22

"Andrew Poelstra" <apoelstra@localhost.localdomain> wrote in message
news:slrneb7fu0.ag.apoelstra@localhost.localdomain...
> 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.

But which of these is more efficient?:
(a) Reading a file of 1000 entries into memory so that each entry can be
read from memory.
(b) Reading each of the 1000 entries from disk individually.

It's a toss up between memory usage or speed, and most people go for speed
and let the memory sort itself out.

--
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация