Re: LLVM miscompiles numeric.c access to short numeric var headers - Mailing list pgsql-hackers

From Greg Stark
Subject Re: LLVM miscompiles numeric.c access to short numeric var headers
Date
Msg-id CAM-w4HOwy3EfmR+kyT0DLnOnf9u3PhJMOwT-5gVDgM2Gmh8ucA@mail.gmail.com
Whole thread Raw
In response to Re: LLVM miscompiles numeric.c access to short numeric var headers  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: LLVM miscompiles numeric.c access to short numeric var headers
List pgsql-hackers
On Thu, Nov 12, 2015 at 3:51 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Meh.  The palloc to create an aligned array of digits would eat up
> any possible performance win --- it'd be just about as expensive
> as the existing unpack operation.

I suppose we would only need to palloc the digits if we found they
were unaligned which would only happen if the varlena header was
packed. So if the varlena header wasn't packed (or if we were just
lucky with the packed alignment which would happen half the time) we
could share the bytes from the packed varlena in the buffer directly
in the var.


> I think we could fix the immediate issue by redeclaring numeric
> headers as arrays of (u)int16 rather than structs.  I'm not
> very excited about the packed-header case.

That would require giving up the pretense that the code supports base
10 and base 100 I suppose. And would still be doing a palloc/memcpy
for data smaller than 128 bytes.

-- 
greg



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: LLVM miscompiles numeric.c access to short numeric var headers
Next
From: Matthijs van der Vleuten
Date:
Subject: Re: psql: add \pset true/false