Re: optimizations

Kevin Atkinson <[email protected]>
Newsgroups gmane.comp.gnu.aspell.devel
Message-ID <Pine.LNX.4.44.0404261958340.1684-100000@kevin-p3.atkinson.dhs.org>
On 26 Apr 2004, Karl Chen wrote:

> >>>>> "Kevin" == Kevin Atkinson <[email protected]> writes:
>     >> Gcc 3.3 requires constants (empty_str) to be initialized.
>     >> (BTW, you could probably make it static const or just write
>     >> the value instead of empty_str)
>     Kevin> 
>     Kevin> Its a minor memory optimization.  The idea is to avoid
>     Kevin> having to dereference a distant memory location just to
>     Kevin> discover that it is the empty string.
> 
> Are you sure this is really worth it?  (I'm asking, not being rude.)
> 
> It seems like a very premature optimization (trying to make sure
> that the string contents are in L1 cache).  For example, if you
> wanted to trade simplicity for acute optimizations you could use
> NULL instead of "" to indicate empty strings to avoid the
> memory-load altogether when reading the value.

Its a minor optimization that is easy to do.  It doesn't do any harm.  
Therefor it is worth it.  There is no point in removing it, is there?

-- 
http://kevin.atkinson.dhs.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.