<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">While we may be tempted to go with the
reason that memcpy is faster (simply because it knows the no of
bytes to be copied in advance and doesn't need to compare each
byte-to-be-copied with a '\0', it is also implementation dependent
and performance could vary depending on if assembler optimizations
to copy several bytes at once are used or not), please note that
these are *functionally* different. While strcpy() will stop
copying on encountering the null terminator, memcpy will copy the
number of bytes passed in past the termination character. They are
meant for different things IMHO, depending on what you want :) In
general its probably better practice to stick to strcpy (or even
better, strncpy) when dealing with strings.<br>
<br>
Anand<br>
<br>
<br>
On 03/24/2014 12:35 PM, Atin Mukherjee wrote:<br>
</div>
<blockquote
cite="mid:399579376.2373304.1395644714965.JavaMail.zimbra@redhat.com"
type="cite">
<div style="font-family: times new roman, new york, times, serif;
font-size: 12pt; color: #000000">
<div>Hi List,<br>
</div>
<div><br>
</div>
<div>In GlusterFS codebase, strcpy() calls have been used in
many places. IMO, if we can replace strcpy calls with memcpy()
we would get a performance bonus as memcpy directly interacts
with memory area. I am posting this suggestion based on my
earlier project experience where we have seen a significant
difference of performance with this replace.<br>
</div>
<div><br>
</div>
<div>Please feel free to add if you think otherwise.<br>
</div>
<div><br>
</div>
<div><span name="x"></span>
<div>Regards,<br>
Atin Mukherjee<br>
Senior Software Engineer<br>
E-9, Extn : 73196, Direct : 08039245196, Mobile:
+919739491377</div>
<div>Email - <a class="moz-txt-link-abbreviated" href="mailto:amukherj@redhat.com">amukherj@redhat.com</a><br>
</div>
<div><span style="font-family: times new roman,new
york,times,serif; font-size: small;"
data-mce-style="font-family: times new roman,new
york,times,serif; font-size: small;"><img
moz-do-not-send="true"
src="imap://ansubram@mail.corp.redhat.com:993/fetch%3EUID%3E/Drafts%3E76298?ui=2&ik=5cf9316a4b&view=att&th=1410c09322ad5849&attid=0.1.1&disp=emb&zw&atsh=1"
data-mce-src="https://mail.google.com/mail/u/0/?ui=2&ik=5cf9316a4b&view=att&th=1410c09322ad5849&attid=0.1.1&disp=emb&zw&atsh=1"
width="163" height="53"></span></div>
<span name="x"></span><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Gluster-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Gluster-devel@nongnu.org">Gluster-devel@nongnu.org</a>
<a class="moz-txt-link-freetext" href="https://lists.nongnu.org/mailman/listinfo/gluster-devel">https://lists.nongnu.org/mailman/listinfo/gluster-devel</a>
</pre>
</blockquote>
<br>
</body>
</html>