Re: Missing free_var() at end of accum_sum_final()?

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: "Andres Freund" <andres(at)anarazel(dot)de>, "Michael Paquier" <michael(at)paquier(dot)xyz>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Missing free_var() at end of accum_sum_final()?
Date: 2023-02-19 19:54:11
Message-ID: 1c7ed4af-be18-4598-b253-ea071c91d9ef@app.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Feb 17, 2023, at 21:26, Andres Freund wrote:
> Removing the free_var()s from numeric_add_opt_error() speeds it up from ~361ms
> to ~338ms.

I notice numeric_add_opt_error() is extern and declared in numeric.h,
called from e.g. timestamp.c and jsonpath_exec.c. Is that a problem,
i.e. is there a risk it could be used in a for loop by some code outside Numeric?

> This code really needs some memory management overhead reduction love. Many
> allocation could be avoided by having a small on-stack "buffer" that's used
> unless the numeric is large.

Nice idea!
Could something like the attached patch work?

/Joel

Attachment Content-Type Size
0001-fixed-buf.patch application/octet-stream 3.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2023-02-19 20:46:10 Re: Handle TEMP_CONFIG for pg_regress style tests in pg_regress.c
Previous Message Justin Pryzby 2023-02-19 19:43:45 Re: Add LZ4 compression in pg_dump