Re: Faster StrNCpy

From: "Sergey E(dot) Koposov" <math(at)sai(dot)msu(dot)ru>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: mark(at)mark(dot)mielke(dot)cc, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Faster StrNCpy
Date: 2006-10-02 19:56:03
Message-ID: Pine.LNX.4.64.0610022344460.12197@lnfm1.sai.msu.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Mark, Tom,

Just the test on IA64 (Itanium2, 1.6Ghz, 8Gb memory). The results seem to
be quite different:

math(at)ptah:~/test$ 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
NONE: 825671 us
MEMCPY: 4533637 us
STRNCPY: 10959380 us
STRLCPY: 34258306 us
LENCPY: 13939373 us
math(at)ptah:~/test$ gcc -O3 -std=c99 -DSTRING='"This is a very long sentence that is expected to be very slow."' -DN="1" -o x x.c y.c strlcpy.c ; ./x
NONE: 938815 us
MEMCPY: 3441330 us
STRNCPY: 5881628 us
STRLCPY: 20167825 us
LENCPY: 11326259 us

math(at)ptah:~/test$ gcc -O3 -std=c99 -DSTRING='"Short sentence."' -DN="(1024*1024)" -o x x.c y.c strlcpy.c ; ./x
NONE: 831920 us
MEMCPY: 4550683 us
STRNCPY: 9339254 us
STRLCPY: 16871433 us
LENCPY: 21332076 us
math(at)ptah:~/test$ gcc -O3 -std=c99 -DSTRING='"Short sentence."' -DN="1" -o x x.c y.c strlcpy.c ; ./x
NONE: 938104 us
MEMCPY: 3438871 us
STRNCPY: 3438969 us
STRLCPY: 6042829 us
LENCPY: 6022909 us

math(at)ptah:~/test$ gcc -O3 -std=c99 -DSTRING='""' -DN="(1024*1024)" -o x x.c y.c strlcpy.c ; ./x
NONE: 825472 us
MEMCPY: 4547456 us
STRNCPY: 8591618 us
STRLCPY: 6818957 us
LENCPY: 8264340 us
math(at)ptah:~/test$ gcc -O3 -std=c99 -DSTRING='""' -DN="1" -o x x.c y.c strlcpy.c ; ./x
NONE: 937878 us
MEMCPY: 3439101 us
STRNCPY: 3188791 us
STRLCPY: 750437 us
LENCPY: 2751238 us

Regards,
Sergey

*******************************************************************
Sergey E. Koposov
Max Planck Institute for Astronomy/Sternberg Astronomical Institute
Tel: +49-6221-528-349
Web: http://lnfm1.sai.msu.ru/~math
E-mail: math(at)sai(dot)msu(dot)ru

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-10-02 20:06:08 Re: Faster StrNCpy
Previous Message mark 2006-10-02 19:43:40 Re: Faster StrNCpy

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-10-02 20:06:08 Re: Faster StrNCpy
Previous Message mark 2006-10-02 19:43:40 Re: Faster StrNCpy