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 1c7ed4af-be18-4598-b253-ea071c91d9ef@app.fastmail.com
Whole thread Raw
In response to Re: Missing free_var() at end of accum_sum_final()?  (Andres Freund <andres@anarazel.de>)
Responses Re: Missing free_var() at end of accum_sum_final()?
List 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

pgsql-hackers by date:

Previous
From: Justin Pryzby
Date:
Subject: Re: Add LZ4 compression in pg_dump
Next
From: Andres Freund
Date:
Subject: Re: Handle TEMP_CONFIG for pg_regress style tests in pg_regress.c