Re: Re: Flat Short of MEMORY_BLOCK

Berend de Boer <[email protected]>
Newsgroups gmane.comp.lang.eiffel.gobo.general
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

"Franck Arnaud" <[email protected]> writes:

>> Just assuming the C compiler will take care of an issue, 
>> isn't a safe bet.
>
> Assuming that memcpy is slower than the array notation 
> seems to me a similarly unsafe bet: maybe some 
> C compilers implement memcpy faster, e.g. if they do 
> a bounds check for arrays they don't do for memcpy.
> C does not require bounds checks, but a C compiler 
> could still do them and display warnings or the like,
> maybe even in optimised mode if it's particularly 
> safety minded.
>
> Premature optimisation has costs (more complexity, 
> bugs, maintenance) so this should be balanced against 
> the benefits, and the benefits are fairly limited 
> when the optimisation technique is only a guess that 
> may turn out not to apply in reality. If this 
> optimisation was proven to often increase performance 
> by 2%, I would also think it's not worth doing.

As you posted some actual code, I was able to test it (unfortunately
not on Windows). FreeBSD 4.9-STABLE with its default compiler gcc
2.95.4:

Two runs:

  array 549
  memcpy 552

  array 551
  memcpy 549

There clearly is a difference.

- -- 
Live long and prosper,

Berend de Boer
(PGP public key: http://www.pobox.com/~berend/berend-public-key.txt)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQFAT+ljIyuuaiRyjTYRAksbAJ9PVYgdShiVGDAcCWa2ss/M63rJGwCgrAjL
Rh1wx27vcpX6huSi7LLSvMg=
=LDvX
-----END PGP SIGNATURE-----



To Post a message, send it to:   [email protected]
To Unsubscribe, send a blank message to: [email protected] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/gobo-eiffel/

<*> To unsubscribe from this group, send an email to:
     [email protected]

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
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.