Skip to content

feat: render budget — work-unit limit, per-function costs, and stats report #222

@Mido-sys

Description

@Mido-sys

Summary

Adds a configurable render budget to Plush that terminates runaway template renders once a work-unit limit is reached. A nil budget is always unlimited, so all existing call sites are completely unaffected.

Motivation

In many cases, slow pages are caused by inefficient template code, but it can be difficult to understand where the time is being spent without adding a lot of temporary debug logging.

A single page may render hundreds of partials, call expensive helpers repeatedly, or loop over large datasets, so it is not always obvious which part of the render is responsible for the slowdown or timeout.

That is where the render budget helps. It gives us a configurable limit for how much work a render is allowed to perform, fails fast when that limit is exceeded, and provides stats that make it easier to identify where the work was spent. This should help keep pages under control while making performance issues easier to debug.

Full details PR#221

Additional Information

@paganotoni , please kindly review.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions