[omniORB-dev] CORBA::string_dup

Duncan Grisby duncan at grisby.org
Mon Oct 6 17:23:48 BST 2003


On Friday 26 September, Serguei Kolos wrote:

> I have noticed that the CORBA::string_dup function uses strcpy to copy 
> strings.
> Unfortunately on many systems strcpy is much slower then for example 
> memcpy.
> For example on Linux (RedHat 7.3) the strcpy is 5 (sic!) times slower. 

Really?  Wow!  I wonder what it's doing.

> What do you think about the idea of using the memcpy in the
> CORBA::string_dup instead of the strcpy? Are there any drawbacks
> with the memcpy?

I suspect that on other platforms memcpy might be slower than strcpy.

Something to try is to replace the call with the obvious for loop.
Between omniORB 3 and 4 I did some profiling and found that strcmp was
stupidly slow, and by far the fastest thing was an inline function
with a for loop. It will probably be the same with strcpy.

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan at grisby.org     --
   -- http://www.grisby.org --



More information about the omniORB-dev mailing list