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