Re: jsonb access operators inefficiency - Mailing list pgsql-hackers

From Teodor Sigaev
Subject Re: jsonb access operators inefficiency
Date
Msg-id 5388B5A6.8060002@sigaev.ru
Whole thread Raw
In response to Re: jsonb access operators inefficiency  (Andrew Dunstan <andrew@dunslane.net>)
List 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
MAXALIGNEDisn'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@sigaev.ru                                      WWW:
http://www.sigaev.ru/



pgsql-hackers by date:

Previous
From: Teodor Sigaev
Date:
Subject: Re: jsonb access operators inefficiency
Next
From: Oleg Bartunov
Date:
Subject: Re: jsonb access operators inefficiency