Re: SP-GiST micro-optimizations - Mailing list pgsql-hackers

From Tom Lane
Subject Re: SP-GiST micro-optimizations
Date
Msg-id 4042.1346175044@sss.pgh.pa.us
Whole thread Raw
In response to SP-GiST micro-optimizations  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: SP-GiST micro-optimizations
List pgsql-hackers
Heikki Linnakangas <heikki.linnakangas@enterprisedb.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



pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: "default deny" for roles
Next
From: Robert Haas
Date:
Subject: Re: MySQL search query is not executing in Postgres DB