On Sun, Feb 19, 2023, at 23:16, Joel Jacobson wrote:
> Hi again,
>
> Ignore previous patch, new correct version attached, that also keeps 
> track of if the buf-field is in use or not.

Ops! One more thinko, detected when trying fixed_buf[8], which caused a seg 
fault.

To fix, a init_var() in alloc_var() is needed when we will use the fixed_buf 
instead of allocating,
since alloc_var() could be called in a loop for existing values, like in 
sqrt_var() for instance.

Attached new version produces similar benchmark results, even with the extra 
init_var():

HEAD:

        format         | pretty_time | count
-----------------------+-------------+-------
 numeric_in(1234,0,-1) | 31 ns       |    74
 numeric_in(1234,0,-1) | 32 ns       |    26
(2 rows)

0003-fixed-buf.patch:

        format         | pretty_time | count
-----------------------+-------------+-------
 numeric_in(1234,0,-1) | 24 ns       |     1
 numeric_in(1234,0,-1) | 25 ns       |    84
 numeric_in(1234,0,-1) | 26 ns       |    15
(3 rows)

/Joel

Attachment: 0003-fixed-buf.patch
Description: Binary data

Reply via email to