- Issue created by @longwave
The obligatory https://stackoverflow.com/questions/1732348/regex-match-open-tags-except... may not apply in this case.
- π¬π§United Kingdom longwave UK
@cilefen yeah we know exactly what we are looking for as Big Pipe also generates the placeholders directly:
'#prefix' => '<span data-big-pipe-placeholder-id="' . Html::escape($big_pipe_placeholder_id) . '">',
I think we should be safe doing a regex match against that.
- Status changed to Needs review
8 months ago 2:29pm 27 March 2024 - π¬π§United Kingdom longwave UK
On the site mentioned in the IS with xhprof enabled, this cuts down the number of function calls on an authenticated homepage load from 997,723 to 501,491 and cuts page load time from 1.7s to just under 1s (though I believe a lot of this is xhprof overhead).
BigPipe::sendContent()
goes from 882ms (51%) down to 126ms (12%). - Status changed to RTBC
8 months ago 3:19pm 28 March 2024 - πΊπΈUnited States smustgrave
Didn't seem to break anything so believe the refactor is fine.
- π¬π§United Kingdom longwave UK
@Berdir spotted the same performance issue as per π [PHP 8.4] Use DOMDocument HTML5 support when available Active , but we can fix this now instead of waiting for PHP 8.4.
- Status changed to Fixed
8 months ago 9:22pm 28 March 2024 - π¬π§United Kingdom catch
Good fix, this is simple enough I'm not sure it'd be worth trying to go back to DOM parsing in PHP 8.4+ too. Committed/pushed to 11.x and cherry-picked to 10.3.x, thanks!
- Status changed to Downport
8 months ago 12:40pm 29 March 2024 - π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
Interesting β we only recently introduced that (about a year ago, in β¨ Interface previews/skeleton screens through optional "preview" or "placeholder" templates Fixed ), it used to use even lower-level parsing:
protected function getPlaceholderOrder($html, $placeholders) { $fragments = explode('<span data-big-pipe-placeholder-id="', $html); array_shift($fragments); $placeholder_ids = []; foreach ($fragments as $fragment) { $t = explode('"></span>', $fragment, 2); $placeholder_id = $t[0]; $placeholder_ids[] = $placeholder_id; }
Would that not be even better?
Re-opening because I see no code archeology mentions here.
- π¬π§United Kingdom catch
@Wim Leers could you open a new issue for that?