Issue Task Resolved

#111000Reduce allocations in implodeAttributes

Wouter Wolters 10/09/26, 18:16 updated 11/09/26, 20:25

Description

Render XHTML attribute fragments during normalization instead of
collecting escaped values and rendering them in a second loop. Return
early for an empty attribute array and avoid escaping blank values that
will be omitted. Preserve escaping, attribute order and duplicate
handling.

Microbenchmarks on PHP 8.5 show 4-11% less time and 38-56% fewer
temporary allocations for six attributes. With 100 attributes,
temporary allocations drop by 34%, with a 2.5-3.4% time increase when
blank attributes are omitted.

Reviews 1

History 13

  1. Wouter Wolters commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-11-09T20:25:11+00:00" > 11/09/26, 20:25 </span>

    Applied in changeset commit:0a015b50b42abae77d2f1eb4769e25c104059a14.