mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-01 07:33:12 +08:00
Every region creation, release and pressure retry walked every condemned region again. A released region that something still refers to was re-walked on each of them, two or three times per build in a watch loop, and each walk visits every object of the region. An attempt that keeps a region now records the references counted to it. Retries at creation, release and region entry attempt a kept region again only when that count has changed, or once the thread has allocated 8 MiB (or the region's size, if larger) in regions since the attempt. That volume doubles after each attempt that finds the count unchanged, up to 64 times. The volume covers references from ordinary objects the walk reaches, which can go away without changing the count. The schedule is per region, so a region that another region's release unblocks is attempted at once, and the full cycle collection before an attempt runs only when some region is due. Adds the region-builds runtime benchmark and a region test for the schedule.