Re: jsonb access operators inefficiency

From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: jsonb access operators inefficiency
Date: 2014-05-30 16:45:26
Message-ID: 5388B5A6.8060002@sigaev.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> I see that palloc.h says:
>
> The result of palloc() is always word-aligned

void *
repalloc(void *pointer, Size size)
{
...
/*
* Try to detect bogus pointers handed to us, poorly though we can.
* Presumably, a pointer that isn't MAXALIGNED isn't pointing at an
* allocated chunk.
*/
Assert(pointer != NULL);
Assert(pointer == (void *) MAXALIGN(pointer));
...

>
>
> so maybe my alignment fear is misplaced. So my remaining question is
> whether this is OK stylistically.

Something like this?
initStringInfoVarlena()/makeStringInfoVarlena()
{
initStringInfo()
appendStringInfoSpaces(jtext, VARHDRSZ);
}

char*
formStringInfoVarlena()
{
SET_VARSIZE(jtext->data, jtext->len);
return jtext->data;
}

--
Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message reiner peterke 2014-05-30 16:49:02 unable to build postgres-9.4 in os x 10.9 with python
Previous Message Teodor Sigaev 2014-05-30 16:27:48 Re: jsonb access operators inefficiency