Hannu Krosing wrote:
> Btw, how did you measure that 30us overhead ?
I measured it with the test program below. With the latest patch it is
no longer 30us, but as far as I can measure 0us.
> Does it involve disk accesses or is it just
> in-memory code that
> speed-concious folks could move to assembly like current
> spinlocking code for some architectures?
For this patch it is an in-memory issue.
--
Chris Bitmead
mailto:chris@bitmead.com
#include <stdio.h>
#include <time.h>
#include "libpq-fe.h"
#define rep 1000000
main() {
int c;
PGconn *conn;
PGresult *res;
time_t t, t2;
conn = PQsetdb(NULL,NULL,NULL,NULL,"foo");
time(&t);
for (c = 0; c < rep; c++) { res = PQexec(conn, "select * from a*"); PQclear(res);
}
time(&t2);
printf("inh %d\n", t2 - t);
time(&t);
for (c = 0; c < rep; c++) { res = PQexec(conn, "select * from only a"); PQclear(res);
}
time(&t2);
printf("no inh %d\n", t2 - t);
PQfinish(conn);
}