Re: SP-GiST micro-optimizations

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SP-GiST micro-optimizations
Date: 2012-08-28 17:30:44
Message-ID: 4042.1346175044@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> writes:
> Drilling into the profile, I came up with three little optimizations:

> 1. Within spgdoinsert, a significant portion of the CPU time is spent on
> line 2033 in spgdoinsert.c:

> memset(&out, 0, sizeof(out));

> That zeroes out a small struct allocated in the stack. Replacing that
> with MemSet() makes it faster, reducing the time spent on zeroing that
> struct from 10% to 1.5% of the time spent in spgdoinsert(). That's not
> very much in the big scheme of things, but it's a trivial change so
> seems worth it.

Fascinating. I'd been of the opinion that modern compilers would inline
memset() for themselves and MemSet was probably not better than what the
compiler could do these days. What platform are you testing on?

The other two changes seem reasonable.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-08-28 17:32:51 Re: MySQL search query is not executing in Postgres DB
Previous Message David Fetter 2012-08-28 17:25:57 "default deny" for roles