Re: Faster StrNCpy

From: "Luke Lonergan" <llonergan(at)greenplum(dot)com>
To: mark(at)mark(dot)mielke(dot)cc, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Faster StrNCpy
Date: 2006-10-02 18:39:49
Message-ID: C146AB05.32C6%llonergan@greenplum.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Mark,

On 9/29/06 2:59 PM, "mark(at)mark(dot)mielke(dot)cc" <mark(at)mark(dot)mielke(dot)cc> wrote:

> Here are results over 64 Mbytes of memory, to ensure that every call is
> a cache miss:

On my Mac OSX intel laptop (Core Duo, 2.16 GHz, 2GB RAM, gcc 4.01):

Luke-Lonergans-Computer:~/strNcpy-perf-test lukelonergan$ gcc -O3 -std=c99
-DSTRING='"This is a very long sentence that is expected to be very slow."'
-DN="(1024*1024)" -o x x.c y.c strlcpy.c ; ./x
/usr/bin/ld: warning multiple definitions of symbol _strlcpy
/var/tmp//cc1eMVq7.o definition of _strlcpy in section (__TEXT,__text)
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libSystem.dylib(strlcpy.So)
definition of _strlcpy
NONE: 416677 us
MEMCPY: 5649587 us
STRNCPY: 5806591 us
STRLCPY: 12865010 us
LENCPY: 17801485 us
Luke-Lonergans-Computer:~/strNcpy-perf-test lukelonergan$ gcc -O3 -std=c99
-DSTRING='"Short sentence."' -DN="(1024*1024)" -o x x.c y.c strlcpy.c ; ./x
/usr/bin/ld: warning multiple definitions of symbol _strlcpy
/var/tmp//ccOZl9R6.o definition of _strlcpy in section (__TEXT,__text)
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libSystem.dylib(strlcpy.So)
definition of _strlcpy
NONE: 416652 us
MEMCPY: 5830540 us
STRNCPY: 6207594 us
STRLCPY: 5582607 us
LENCPY: 7887703 us
Luke-Lonergans-Computer:~/strNcpy-perf-test lukelonergan$ gcc -O3 -std=c99
-DSTRING='""' -DN="(1024*1024)" -o x x.c y.c strlcpy.c ; ./x
/usr/bin/ld: warning multiple definitions of symbol _strlcpy
/var/tmp//ccBUsIdR.o definition of _strlcpy in section (__TEXT,__text)
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libSystem.dylib(strlcpy.So)
definition of _strlcpy
NONE: 417210 us
MEMCPY: 5506346 us
STRNCPY: 5769302 us
STRLCPY: 5424234 us
LENCPY: 5609338 us

- Luke

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message mark 2006-10-02 19:43:40 Re: Faster StrNCpy
Previous Message Tom Lane 2006-10-02 18:30:11 Re: Faster StrNCpy

Browse pgsql-patches by date

  From Date Subject
Next Message mark 2006-10-02 19:43:40 Re: Faster StrNCpy
Previous Message Tom Lane 2006-10-02 18:30:11 Re: Faster StrNCpy