This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Using memcpy instead of `*dst++ = *src++'
- To: "guile at sourceware dot cygnus dot com" <guile at sourceware dot cygnus dot com>
- Subject: Using memcpy instead of `*dst++ = *src++'
- From: "Dale P. Smith" <dpsm at en dot com>
- Date: Mon, 5 Jun 2000 08:51:21 -0400
- Organization: Altus Technologies Corporation.
Does it make any sense to change scm_makfromstr from:
SCM
scm_makfromstr (const char *src, scm_sizet len, int slots)
{
SCM s = scm_makstr (len, slots);
char *dst = SCM_CHARS (s);
while (len--)
*dst++ = *src++;
return s;
}
to something like:
SCM
scm_makfromstr (const char *src, scm_sizet len, int slots)
{
SCM s = scm_makstr (len, slots);
memcpy (SCM_CHARS (s), src, len);
return s;
}
??? I would guess that for small strings the overhead of a function call might slow things down. But memcpy is supposedly tuned for better performance that a simple char by char copy. I got a
slight improvement, but it was in the system, not user timings. ??? It's probably very architecture and C library dependent.
-Dale
--
Dale P. Smith
Altus Technologies Corp.
dsmith@altustech.com
400-746-9000 x309