Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Denis A Ustimenko <denis(at)oldham(dot)ru>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c
Date: 2002-10-16 05:40:41
Message-ID: 200210160540.g9G5efA07216@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Joe Conway wrote:
> Bruce Momjian wrote:
> > Yes, the new code has _three_ time() calls, rather than the old code
> > that I think only had two. I was going to mention it but I figured
> > time() was a pretty light system call, sort of like getpid().
> >
> > I needed the additional time() calls so the computation of remaining
> > time was more accurate, i.e. we are not resetting the timer on a
> > select() EINTR anymore.
> >
> > Should I try to rework it?
> >
>
> I tried two more runs of 10000, and the average is pretty steady at 0.0087.
> However the total range is a fair bit wider than I originally reported.
>
> I added a forth time() call to see what the effect would be. It increased the
> average to 0.0089 (two runs of 10000 connects each), so I don't think the
> time() call explains the entire difference.
>
> Not sure this is worth worrying about or not. I'd guess anyone serious about
> keeping connect time to a minimum uses some kind of connection pool or
> persistent connection anyway.

Well, the fact you see a change of 0.0002 is significant. Let me add
that in the old code there was only one time() call _in_ the loop, while
now, there are two, so I can easily see there are several additional
time() calls. Did you put your calls in the while loop?

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gavin Sherry 2002-10-16 05:40:47 Re: Postgresql and multithreading
Previous Message Bruce Momjian 2002-10-16 05:38:59 Re: Postgresql and multithreading