[php-src] PR #23949: lexbor: Shrink the initial tokenizer pools and mraw cache

From: Date: Sun, 27 Sep 2026 18:21:16 +0000
Subject: [php-src] PR #23949: lexbor: Shrink the initial tokenizer pools and mraw cache
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-38863@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/23949 Author: nicolas-grekas Dom\HTMLDocument::createFromString() and setting innerHTML allocate about 1.1MB on every call, even for a few bytes of input, because lexbor preallocates 4096 tokens, 4096 token attributes and, in each of the 7 lexbor_mraw_t of a parser, 512 entries for its cache of freed blocks. It's freed after the call, but it's enough to push a small request into a second 2MB memory chunk. The tree builder uses a single token and these pools grow on demand, so this makes them start with 16 tokens, 256 attributes and 64 cache entries. The change is carried as patch 0016 until lexbor/lexbor#427 lands upstream. Parsing a small string then needs about 230KB instead of 1.1MB, and large documents parse as fast as before.

« previous php.git-pulls (#38863) next »