public inbox for [email protected]  
help / color / mirror / Atom feed
From: Jacob Champion <[email protected]>
To: Andrew Dunstan <[email protected]>
Cc: Robert Haas <[email protected]>
Cc: Peter Smith <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: WIP Incremental JSON Parser
Date: Mon, 25 Mar 2024 16:21:40 -0700
Message-ID: <CAOYmi+=rFhT_muEeaUP6eJ-NETkfaPRbehrrdYD5+1S5fbfXqw@mail.gmail.com> (raw)
In-Reply-To: <CAOYmi+kQ1kB16_ocQxCQrzHuKK=dyVPcM7+wAUgpys5EUnWpjw@mail.gmail.com>
References: <[email protected]>
	<[email protected]>
	<CAOYmi+mZ6ZVDHsP6Fcx+3vGYRSY+7fXmQP7wNuk1KTOVtwK2Pw@mail.gmail.com>
	<CAOYmi+mZER=D1gEDOt7Td8tB214eHFbViYvDvEjF4uiJ3bFv=A@mail.gmail.com>
	<[email protected]>
	<CAOYmi+kLQmvpGzMsry67B5=1JYhm04rv8J7QX-qh3Xy-kceGJw@mail.gmail.com>
	<[email protected]>
	<CAOYmi+nHV55Uhz+o-HKq0GNiWn2L5gMcuyRQEz_fqpGY=pFxKA@mail.gmail.com>
	<CAOYmi+=DAS_SpWM8Qd-C2Cv0yWUkENbsHcjEYt4vdCAp_BG_Jw@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<CAOYmi+kOY47od5NuB+379XSnAfTknocLkYV6qz+Gk1XRPwG1iQ@mail.gmail.com>
	<CAOYmi+kNPw+3hjjQarC8bm-iDa=CRmTB1TMb35zbydRLK+7+1A@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<CAOYmi+n1dZEMCptykQS7Jd4A_bMyebAD9LuFXM4NaeaYKwH3ng@mail.gmail.com>
	<[email protected]>
	<CAOYmi+kgckFsBNOBsrekDipq88G56pVndVXKcA7qMWYx9feChQ@mail.gmail.com>
	<CAD5tBcLjFnTnAvUpQg-K5sJa3ECnEj8CQZ-AYrH1k+F=42D+Vg@mail.gmail.com>
	<CAOYmi+n1fxCt3QGz9g=GfY1+J6__vVqsAud=HYwpUrfZM_VJHw@mail.gmail.com>
	<CAD5tBcLi2ffZkktV2qrsKSBykE-N8CiYgrfbv0vZ-F7=xLFeqw@mail.gmail.com>
	<CAD5tBcJg-Ja3CcY8N+NtziFN8TL8JRWv97s=-siT=Oep2+JGjw@mail.gmail.com>
	<CAOYmi+nY=rF6dJCzaOuA3d-3FbwXCcecOs_S1NutexFA3dRXAw@mail.gmail.com>
	<CAOYmi+m8yeRLFPj68e0zOfZGKm1CAmWwrfsEmCjYxPTWn7itnA@mail.gmail.com>
	<CAD5tBcLm=+LUrGZftmRGxq1tWE9eAcviVJgEF=AX8P_=NDd=eg@mail.gmail.com>
	<CAOYmi+nEs4wVLSU4=sZU1Mf7j-bmsQoYD7CMZoEhwtNvz1jTOQ@mail.gmail.com>
	<CAD5tBcK-RzoWpwb2UBHFOoMxrn1LHaKGt_XJd9wKiQg=rwBjNA@mail.gmail.com>
	<CAOYmi+kQ1kB16_ocQxCQrzHuKK=dyVPcM7+wAUgpys5EUnWpjw@mail.gmail.com>

On Mon, Mar 25, 2024 at 4:12 PM Jacob Champion
<[email protected]> wrote:
> Stack size should be pretty limited, at least on the platforms I'm
> familiar with. So yeah, the recursive descent will segfault pretty
> quickly, but it won't repalloc() an unbounded amount of heap space.
> The alternative would just be to go back to a hardcoded limit in the
> short term, I think.

And I should mention that there are other ways to consume a bunch of
memory, but I think they're bounded by the size of the JSON file.
Looks like the repalloc()s amplify the JSON size by a factor of ~20
(JS_MAX_PROD_LEN + sizeof(char*) + sizeof(bool)). That may or may not
be enough to be concerned about in the end, since I think it's still
linear, but I wanted to make sure it was known.

--Jacob






view thread (44+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: WIP Incremental JSON Parser
  In-Reply-To: <CAOYmi+=rFhT_muEeaUP6eJ-NETkfaPRbehrrdYD5+1S5fbfXqw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox