Re: Missing free_var() at end of accum_sum_final()? - Mailing list pgsql-hackers

From Joel Jacobson
Subject Re: Missing free_var() at end of accum_sum_final()?
Date
Msg-id c307ce58-04ba-4df5-8f0d-3d02472fb2a7@app.fastmail.com
Whole thread Raw
In response to Missing free_var() at end of accum_sum_final()?  ("Joel Jacobson" <joel@compiler.org>)
List pgsql-hackers
Hi,

I found another small but significant improvement of the previous patch:

else if (ndigits < var->buf_len)
{
-    memset(var->buf, 0, var->buf_len);
+    var->buf[0] = 0;
    var->digits = var->buf + 1;
    var->ndigits = ndigits;
}


We don't need to set all buf elements to zero, only the first one.
This is not an improvement of HEAD, it's just a mistake I made in my previous patch.


COPY foo FROM '/tmp/random-numerics.csv';

HEAD:

Time: 8431.325 ms (00:08.431)
Time: 8424.749 ms (00:08.425)
Time: 8425.387 ms (00:08.425)
Time: 8519.869 ms (00:08.520)
Time: 8452.585 ms (00:08.453)

0004-fixed-buf.patch:
Time: 8539.475 ms (00:08.539)
Time: 8401.628 ms (00:08.402)
Time: 8399.440 ms (00:08.399)
Time: 8373.861 ms (00:08.374)
Time: 8388.002 ms (00:08.388)

0005-fixed-buf.patch:

Time: 8038.218 ms (00:08.038)
Time: 8082.898 ms (00:08.083)
Time: 7999.950 ms (00:08.000)
Time: 8039.640 ms (00:08.040)
Time: 7994.816 ms (00:07.995)

Almost half a second faster!

/Joel
Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Killing off removed rels properly
Next
From: Matthias van de Meent
Date:
Subject: Re: Ignoring BRIN for HOT updates (was: -udpates seems broken)