Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Speeding code

Author: Tom Kerrigan

Date: 01:54:58 05/13/03

Go up one level in this thread


On May 12, 2003 at 14:49:21, Dieter Buerssner wrote:

>On May 12, 2003 at 14:43:00, Tom Kerrigan wrote:
>
>>On May 12, 2003 at 10:38:57, Fermin Serrano wrote:
>>>	Question 3:
>>>	-----------------
>>>	To copy a structure into other, what is faster, doing by copy each of his
>>>elements or use a memcpy?
>>
>>Use memcpy. It may not be faster on your system, but it's optimized on other
>>systems that you might use later. If you copy individual elements yourself,
>>there's no chance it will be optimized on any system.
>
>I don't agree. Use the assignment operator ("=")! It should never do worse than
>memcpy or copying individual members. On many compilers, it will make no

You're probably right, assuming your compiler supports copying structures. I
recall that some don't, but I imagine most current ones do.

-Tom



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.