Re: tweaking MemSet() performance - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: tweaking MemSet() performance
Date
Msg-id 200208300307.g7U373A16220@candle.pha.pa.us
Whole thread Raw
In response to Re: tweaking MemSet() performance  (Andrew Sullivan <andrew@libertyrms.info>)
Responses Re: tweaking MemSet() performance
Re: tweaking MemSet() performance
Re: tweaking MemSet() performance
List pgsql-hackers
Would you please retest this.  I have attached my email showing a
simpler test that is less error-prone.

I can't come up with any scenario that would produce what you have
reported.  If I look at function call cost, MemSet loop efficiency, and
memset loop efficiency, I can't come up with a combination that produces
what you reported.

The standard assumption is that function call overhead is significant,
and that memset it faster than C MemSet.  What compiler are you using?
Is the memset() call being inlined by the compiler?  You will have to
look at the assembler code to be sure.

My only guess is that memset is inlined and that it is only moving
single bytes.  If that is the case, there is no function call overhead
and it would explain why MemSet gets faster as the buffer gets larger.

---------------------------------------------------------------------------

Andrew Sullivan wrote:
> On Thu, Aug 29, 2002 at 01:27:41AM -0400, Neil Conway wrote:
> >
> > Also, if anyone would like to contribute the results of doing the
> > benchmark on their particular system, that might provide some useful
> > additional data points.
>
> Ok, here's a run on a Sun E450, Solaris 7.  I presume your "total"
> time label corresponds to my "real" time.  That's what I'm including,
> anyway.
>
> System Configuration:  Sun Microsystems  sun4u Sun Enterprise 450 (2
> X UltraSPARC-II 400MHz)
> System clock frequency: 100 MHz
> Memory size: 2560 Megabytes
>
> BUFFER_SIZE = 64
>         MemSet(): 0m13.343s,12.567s,13.659s
>         memset(): 0m1.255s,0m1.258s,0m1.254s
>
> BUFFER_SIZE = 128
>         MemSet(): 0m21.347s,0m21.200s,0m20.541s
>         memset(): 0m18.041s,0m17.963s,0m17.990s
>
> BUFFER_SIZE = 256
>         MemSet(): 0m38.023s,0m37.480s,0m37.631s
>         memset(): 0m25.969s,0m26.047s,0m26.012s
>
> BUFFER_SIZE = 512
>         MemSet(): 1m9.226s,1m9.901s,1m10.148s
>         memset(): 2m17.897s,2m18.310s,2m17.984s
>
> BUFFER_SIZE = 1024
>         MemSet(): 2m13.690s,2m13.981s,2m13.206s
>         memset(): 4m43.195s,4m43.405s,4m43.390s
>
> . . .at which point I gave up.
>
> A
>
> --
> ----
> Andrew Sullivan                         204-4141 Yonge Street
> Liberty RMS                           Toronto, Ontario Canada
> <andrew@libertyrms.info>                              M2P 2A8
>                                          +1 416 646 3304 x110
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-hackers by date:

Previous
From: Gordon Runkle
Date:
Subject: [7.3devl] Using PGPASSWORDFILE with psql requires -U option?
Next
From: Bruce Momjian
Date:
Subject: Re: [SQL] LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1?