|
From: Philippe W. <phi...@sk...> - 2014-07-25 22:15:20
|
On Fri, 2014-07-25 at 05:58 -0700, John Reiser wrote: > > + VG_(strncpy_safely)(buf, "???", nbuf); // unknown symbol > > Beware performance loss. strncpy _always_ writes nbuf bytes (3rd argument), > so the execution of that code finishes with the equivalent of > memset(&buf[3], 0, nbuf - 3); > > This will be much faster: > memcpy(buf, "???", 3+1); > as long as the other code requires only one terminating '\0'. > [Dress up with the appropriate VG_() and other adornments.] Funny that we just got a big performance regression due to the rewriting of VG_(strncpy_safely) : it was not zero-filling and since rev 14186, it is zero filling. That gave for some tests more than 50% perf regressions. Philippe |