Skip to content

move json line tracking off the success path#22487

Open
henderkes wants to merge 1 commit into
php:masterfrom
henderkes:perf/yyjson
Open

move json line tracking off the success path#22487
henderkes wants to merge 1 commit into
php:masterfrom
henderkes:perf/yyjson

Conversation

@henderkes

@henderkes henderkes commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

should get rid of most of the performance penalty introduced by b80ffc5

cross-link #22277 (comment)

Reasoning: I'm thinking that successful json parses should be much more common than failed ones. So instead of paying a noticeable cost on every successful json parse, that never reports an error, we should instead only pay error reporting cost when it happens. This is a trade-off of paying a higher penalty in the error case to keep the expected case clean.

I've not benchmarked the error path yet, but for running phpstan on phpstan-src, it shaves about a second off of execution time.

@henderkes henderkes changed the title move json line tracking off the hot path move json line tracking off the success path Jun 28, 2026
@henderkes henderkes marked this pull request as ready for review June 28, 2026 15:43
@henderkes henderkes requested a review from bukka as a code owner June 28, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant