Skip to content

Commit 7d5ec0a

Browse files
author
Nikita Glukhov
committed
Don't decompress whole JEntrys of arrays
1 parent 61e8839 commit 7d5ec0a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

contrib/jsonb_toaster/jsonb_toaster.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,11 +1800,11 @@ JsonbzArrayIteratorInit(JsonbzArrayIterator *it, CompressedJsonb *cjb)
18001800
JsonbDatum *jb = (JsonbDatum *) cjb->iter->buf->buf;
18011801
const JsonbContainerHeader *jbc = (const JsonbContainerHeader *)((char *) jb + cjb->offset);
18021802

1803-
jsonxzDecompressTo(cjb, cjb->offset + ((char *) &jbc->children - (char *) jbc));
1803+
//jsonxzDecompressTo(cjb, cjb->offset + ((char *) &jbc->children - (char *) jbc));
18041804

18051805
it->count = (cjb->header & JBC_CMASK);
18061806

1807-
jsonxzDecompressTo(cjb, cjb->offset + ((char *) &jbc->children[it->count] - (char *) jbc));
1807+
//jsonxzDecompressTo(cjb, cjb->offset + ((char *) &jbc->children[it->count] - (char *) jbc));
18081808

18091809
it->cjb = cjb;
18101810
it->container = jbc;
@@ -1816,9 +1816,14 @@ JsonbzArrayIteratorInit(JsonbzArrayIterator *it, CompressedJsonb *cjb)
18161816
static bool
18171817
JsonbzArrayIteratorNext(JsonbzArrayIterator *it, JsonValue *result)
18181818
{
1819+
const void *jb = it->cjb->iter->buf->buf;
1820+
const JsonbContainer *jbc = (const JsonbContainer *)((char *) jb + it->cjb->offset);
1821+
18191822
if (it->index >= it->count)
18201823
return false;
18211824

1825+
jsonxzDecompressTo(it->cjb, (char *) &jbc->children[it->count] - (char *) jb);
1826+
18221827
fillCompressedJsonbValue(it->cjb, it->container, it->index, it->base_addr,
18231828
it->offset, result);
18241829

@@ -1831,9 +1836,14 @@ JsonbzArrayIteratorNext(JsonbzArrayIterator *it, JsonValue *result)
18311836
static JsonValue *
18321837
JsonbzArrayIteratorGetIth(JsonbzArrayIterator *it, uint32 index)
18331838
{
1839+
const void *jb = it->cjb->iter->buf->buf;
1840+
const JsonbContainer *jbc = (const JsonbContainer *)((char *) jb + it->cjb->offset);
1841+
18341842
if (index >= it->count)
18351843
return NULL;
18361844

1845+
jsonxzDecompressTo(it->cjb, (char *) &jbc->children[index + 1] - (char *) jb);
1846+
18371847
return fillCompressedJsonbValue(it->cjb, it->container, index,
18381848
it->base_addr,
18391849
getJsonbOffset(it->container, index),

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy