Repository navigation
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
428153b to
24da950
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
763339e to
ba00cc9
Compare
| * | ||
| * @return bool Whether an attribute was found. Returns `false` upon reaching the end | ||
| * of the tag (`>` or `/>`) or the end of the document. | ||
| * @since 7.3.0 |
There was a problem hiding this comment.
Is this not actually targeting 7.2?
| * @since 7.3.0 | |
| * @since 7.2.0 |
There was a problem hiding this comment.
Since 7.2.0 is in beta, I think it’s too late to add enhancements. There’s no bug here, so this isn’t a fix.
The private `parse_next_attribute()` method was always called in a loop, until all attributes were exhausted and the end of the tag was reached. The method is replaced with `parse_all_attributes()` that loops internally until no more attributes are found. `parse_all_attributes()` also consistently sets the incomplete state flag if the attribute parsing does not terminate before exhausting the input string, indicating an incomplete token. This simplifies calling code and eliminates duplicate and redundant checks, establishing the invariant that `parse_all_attributes()` will always terminate on the tag's closing `>` _OR_ will set the incomplete input state.
- strspn skipped whitespace - leading "=" gives at least length 1 - strcspn must be at least 1
When the next byte is `>`, parse_all_attributes() now stops without calling strspn() for whitespace and slashes. On the matching base this made the Tag Processor 2.8% faster with tracing JIT and 1.8% faster with JIT off, with no difference for the HTML Processor.
This reverts commit 03d8747.
2442d34 to
26ad776
Compare
dmsnell
left a comment
There was a problem hiding this comment.
Benchmarks show about 10% less Tag Processor parsing time with tracing JIT and 9% without; the loop refactor alone saves about 4%. The HTML Processor shows no measured difference. These results use next_token() on 32 documents (19 real pages, 13 synthetic), PHP 8.5.12. The current PR head was not benchmarked.
I ran this in my WIP branch with automated testing and I’m attaching its report at the end of this comment.
I’ve been pondering this but don’t have a strong sense yet. Something about it feels wrong to me, but I don’t know exactly why. You are probably right and have the right intuition. The removal of the individual attribute parse seems like a loss.
HTML API CommonCrawl analysis
Parsed 21,111 documents from CommonCrawl CC-MAIN-2026-43 with the target branch (e98fa1c929) and with this PR merged into it (88eb647353). Each time is the median of 2 rounds. Negative deltas mean the PR is faster. Workflow run.
The WARC file read
crawl-data/CC-MAIN-2026-43/segments/1791170055212.25/warc/CC-MAIN-20261014123931-20261014153931-00173.warc.gz
It was picked at random with seed 429502308. Run the workflow manually with this seed and crawl CC-MAIN-2026-43 to analyze the same documents again.
HTML Processor parse time
All documents, including those where parsing stopped early on unsupported markup:
| Group | Docs | Target total | PR total | Δ total | Δ total % | Mean Δ/doc | Median Δ/doc | Median Δ%/doc | p95 Δ/doc |
|---|---|---|---|---|---|---|---|---|---|
| All | 21,111 | 881.68 s | 881.54 s | −145.64 ms | −0.02% | −6.9 µs | −176.0 µs | −0.99% | +2.56 ms |
| Small (< 32 KiB) | 3,634 | 34.43 s | 34.57 s | +139.47 ms | +0.41% | +38.4 µs | −20.2 µs | −0.77% | +1.19 ms |
| Medium | 13,752 | 479.44 s | 479.06 s | −383.27 ms | −0.08% | −27.9 µs | −222.5 µs | −0.98% | +2.43 ms |
| Large (≥ 256 KiB) | 3,725 | 367.81 s | 367.91 s | +98.16 ms | +0.03% | +26.4 µs | −617.3 µs | −1.18% | +4.38 ms |
Documents supported by both the target branch and the PR (16,225):
| Group | Docs | Target total | PR total | Δ total | Δ total % | Mean Δ/doc | Median Δ/doc | Median Δ%/doc | p95 Δ/doc |
|---|---|---|---|---|---|---|---|---|---|
| All | 16,225 | 692.25 s | 691.88 s | −373.24 ms | −0.05% | −23.0 µs | −177.5 µs | −0.98% | +2.59 ms |
| Small (< 32 KiB) | 3,244 | 31.31 s | 31.43 s | +121.58 ms | +0.39% | +37.5 µs | −21.1 µs | −0.79% | +1.22 ms |
| Medium | 10,170 | 372.52 s | 372.17 s | −350.60 ms | −0.09% | −34.5 µs | −250.3 µs | −0.96% | +2.50 ms |
| Large (≥ 256 KiB) | 2,811 | 288.43 s | 288.28 s | −144.21 ms | −0.05% | −51.3 µs | −665.8 µs | −1.18% | +4.94 ms |
%%{init: {"themeVariables": {"xyChart": {"plotColorPalette": "#2271b1, #d63638"}}}}%%
xychart-beta
title "HTML Processor: median parse time by document size"
x-axis "Document size (bytes, at least)" ["8K", "16K", "32K", "64K", "128K", "256K", "512K"]
y-axis "Median time (ms)"
line [7.727, 13.287, 19.978, 28.587, 41.277, 57.76, 64.353]
line [7.686, 13.535, 19.888, 28.531, 41.22, 57.696, 64.303]
Blue: target branch. Red: PR merged into the target branch. Sizes at either end with fewer than 2% of documents are not drawn (1,181 documents).
Largest HTML Processor slowdowns
| URL | Size | Target | PR | Δ | Δ% |
|---|---|---|---|---|---|
https://zone.bz/registration/?lc=de-DE |
622 KiB | 474.92 ms | 905.28 ms | +430.36 ms | +90.62% |
https://ymzmarket.ru/catalog/dvigateli-yamz-530/53406-1000175-10-dvigatel-s-oborudovaniem/ |
1.1 MiB | 418.20 ms | 756.88 ms | +338.68 ms | +80.99% |
https://yalehardwareph.com/product/groz-stainless-bore-taper-gauge/ |
898 KiB | 208.86 ms | 378.76 ms | +169.90 ms | +81.35% |
https://xtutti.com/search/iPage,3/category,moto-e-scooter/sOrder,i_price/iOrderType,desc/sShowAs,ga… |
354 KiB | 215.27 ms | 379.01 ms | +163.74 ms | +76.06% |
https://xn----ftbbguipi1b3i.xn--p1ai/catalog/baza-top-praymer/tops/top-bez-lipkogo-sloya/8836/ |
438 KiB | 170.52 ms | 307.64 ms | +137.12 ms | +80.42% |
https://zelluloza.ru/books/7550-Luchshaya-pyaterka-Bezdna/ |
673 KiB | 166.37 ms | 288.20 ms | +121.84 ms | +73.23% |
https://xn-----mlcmbbnctfc9anx4ak5a1d.xn--p1ai/catalog/mebelnye_fasady/pvkh_plenki_dlya_fasadov/pvk… |
376 KiB | 139.12 ms | 260.53 ms | +121.41 ms | +87.26% |
https://zvkn.ru/catalog/teplovoe_oborudovanie/pechi_mikrovolnovye/ |
601 KiB | 135.37 ms | 251.44 ms | +116.06 ms | +85.74% |
http://11ru.ru/shop/teplitsi |
1.2 MiB | 336.45 ms | 427.91 ms | +91.46 ms | +27.18% |
https://www.zbma.net/tournament/35080 |
650 KiB | 308.96 ms | 398.13 ms | +89.16 ms | +28.86% |
Tag Processor parse time
| Group | Docs | Target total | PR total | Δ total | Δ total % | Mean Δ/doc | Median Δ/doc | Median Δ%/doc | p95 Δ/doc |
|---|---|---|---|---|---|---|---|---|---|
| All | 21,111 | 139.50 s | 131.14 s | −8.36 s | −5.99% | −396.0 µs | −269.9 µs | −6.69% | +530.0 µs |
| Small (< 32 KiB) | 3,634 | 5.07 s | 4.81 s | −267.51 ms | −5.27% | −73.6 µs | −67.0 µs | −6.02% | +220.9 µs |
| Medium | 13,752 | 74.65 s | 70.17 s | −4.49 s | −6.01% | −326.4 µs | −295.0 µs | −6.80% | +593.1 µs |
| Large (≥ 256 KiB) | 3,725 | 59.78 s | 56.17 s | −3.61 s | −6.03% | −967.9 µs | −723.9 µs | −6.82% | +857.8 µs |
%%{init: {"themeVariables": {"xyChart": {"plotColorPalette": "#2271b1, #d63638"}}}}%%
xychart-beta
title "Tag Processor: median parse time by document size"
x-axis "Document size (bytes, at least)" ["8K", "16K", "32K", "64K", "128K", "256K", "512K"]
y-axis "Median time (ms)"
line [1.126, 1.945, 3.024, 4.584, 6.914, 10.063, 13.002]
line [1.082, 1.837, 2.855, 4.288, 6.459, 9.495, 12.084]
Blue: target branch. Red: PR merged into the target branch. Sizes at either end with fewer than 2% of documents are not drawn (1,181 documents).
Largest Tag Processor slowdowns
| URL | Size | Target | PR | Δ | Δ% |
|---|---|---|---|---|---|
https://ymzmarket.ru/catalog/dvigateli-yamz-530/53406-1000175-10-dvigatel-s-oborudovaniem/ |
1.1 MiB | 44.85 ms | 99.28 ms | +54.42 ms | +121.33% |
https://zone.bz/registration/?lc=de-DE |
622 KiB | 44.71 ms | 84.69 ms | +39.98 ms | +89.43% |
https://yalehardwareph.com/product/groz-stainless-bore-taper-gauge/ |
898 KiB | 25.30 ms | 50.22 ms | +24.92 ms | +98.49% |
https://xtutti.com/search/iPage,3/category,moto-e-scooter/sOrder,i_price/iOrderType,desc/sShowAs,ga… |
354 KiB | 23.30 ms | 45.10 ms | +21.80 ms | +93.56% |
https://zelluloza.ru/books/7550-Luchshaya-pyaterka-Bezdna/ |
673 KiB | 21.40 ms | 40.76 ms | +19.36 ms | +90.45% |
https://zvkn.ru/catalog/teplovoe_oborudovanie/pechi_mikrovolnovye/ |
601 KiB | 18.32 ms | 35.78 ms | +17.46 ms | +95.29% |
https://xn----ftbbguipi1b3i.xn--p1ai/catalog/baza-top-praymer/tops/top-bez-lipkogo-sloya/8836/ |
438 KiB | 18.56 ms | 35.29 ms | +16.73 ms | +90.10% |
https://xn-----mlcmbbnctfc9anx4ak5a1d.xn--p1ai/catalog/mebelnye_fasady/pvkh_plenki_dlya_fasadov/pvk… |
376 KiB | 16.76 ms | 32.06 ms | +15.29 ms | +91.23% |
https://yanao.cian.ru/snyat-3-komnatnuyu-kvartiru-s-detmi-yanao-novyy-urengoy/ |
2.5 MiB | 18.33 ms | 33.21 ms | +14.89 ms | +81.23% |
https://www.fomosoc.com/p/musecpu-kp61 |
460 KiB | 15.20 ms | 29.72 ms | +14.52 ms | +95.53% |
wp_kses() time
Time for wp_kses( $html, 'post' ). Only the files it needs are loaded, without WordPress's default filters such as those on pre_kses, so times differ from a full site.
| Group | Docs | Target total | PR total | Δ total | Δ total % | Mean Δ/doc | Median Δ/doc | Median Δ%/doc | p95 Δ/doc |
|---|---|---|---|---|---|---|---|---|---|
| All | 21,111 | 394.20 s | 384.79 s | −9.41 s | −2.39% | −445.8 µs | −121.7 µs | −3.30% | +656.0 µs |
| Small (< 32 KiB) | 3,634 | 23.76 s | 23.26 s | −502.22 ms | −2.11% | −138.2 µs | −77.4 µs | −3.03% | +518.8 µs |
| Medium | 13,752 | 222.00 s | 216.54 s | −5.47 s | −2.46% | −397.4 µs | −126.8 µs | −3.46% | +696.3 µs |
| Large (≥ 256 KiB) | 3,725 | 148.44 s | 144.99 s | −3.44 s | −2.32% | −924.5 µs | −144.4 µs | −2.99% | +659.0 µs |
%%{init: {"themeVariables": {"xyChart": {"plotColorPalette": "#2271b1, #d63638"}}}}%%
xychart-beta
title "wp_kses(): median time by document size"
x-axis "Document size (bytes, at least)" ["8K", "16K", "32K", "64K", "128K", "256K", "512K"]
y-axis "Median time (ms)"
line [5.669, 9.663, 12.021, 13.143, 2.648, 2.958, 18.465]
line [5.577, 9.494, 11.673, 12.952, 2.544, 2.867, 18.484]
Blue: target branch. Red: PR merged into the target branch. Sizes at either end with fewer than 2% of documents are not drawn (1,181 documents).
Largest wp_kses() slowdowns
| URL | Size | Target | PR | Δ | Δ% |
|---|---|---|---|---|---|
https://zelluloza.ru/books/7550-Luchshaya-pyaterka-Bezdna/ |
673 KiB | 142.23 ms | 238.01 ms | +95.78 ms | +67.34% |
https://xn-----mlcmbbnctfc9anx4ak5a1d.xn--p1ai/catalog/mebelnye_fasady/pvkh_plenki_dlya_fasadov/pvk… |
376 KiB | 116.71 ms | 207.67 ms | +90.96 ms | +77.94% |
https://zvkn.ru/catalog/teplovoe_oborudovanie/pechi_mikrovolnovye/ |
601 KiB | 111.25 ms | 197.85 ms | +86.59 ms | +77.83% |
http://11ru.ru/shop/teplitsi |
1.2 MiB | 295.18 ms | 366.66 ms | +71.48 ms | +24.22% |
https://xtutti.com/search/iPage,3/category,moto-e-scooter/sOrder,i_price/iOrderType,desc/sShowAs,ga… |
354 KiB | 71.07 ms | 133.96 ms | +62.88 ms | +88.48% |
https://xn--80apbedja6ba9b.xn--p1ai/ |
302 KiB | 78.82 ms | 140.45 ms | +61.64 ms | +78.20% |
https://youlun.tuniu.com/ship/519 |
260 KiB | 73.46 ms | 130.13 ms | +56.67 ms | +77.14% |
https://xn--80aalafqyuo0a6i.xn--p1ai/catalog/zapchasti_dlya_bytovoy_tekhniki/zapchasti_dlya_pylesos… |
451 KiB | 71.80 ms | 124.90 ms | +53.10 ms | +73.95% |
https://xn--b1aftlcheoc0h.xn--p1ai/car/lexus/lm/ |
242 KiB | 68.68 ms | 119.70 ms | +51.02 ms | +74.29% |
https://www.zooplus.ro/shop/pisici/gustari_recompense_pisici/trixie/2582308?activeVariant=2582308.2 |
760 KiB | 63.68 ms | 111.61 ms | +47.93 ms | +75.27% |
HTML Processor support
| Group | Docs | Unsupported (target) | Unsupported (PR) | Δ | Incomplete (target) | Incomplete (PR) |
|---|---|---|---|---|---|---|
| All | 21,111 | 4,886 (23.1%) | 4,886 (23.1%) | 0 | 24 | 24 |
| Small (< 32 KiB) | 3,634 | 390 (10.7%) | 390 (10.7%) | 0 | 3 | 3 |
| Medium | 13,752 | 3,582 (26.0%) | 3,582 (26.0%) | 0 | 18 | 18 |
| Large (≥ 256 KiB) | 3,725 | 914 (24.5%) | 914 (24.5%) | 0 | 3 | 3 |
Incomplete documents end inside a token, usually because the crawler truncated them. They are not counted as unsupported.
Unsupported documents by the reason the HTML Processor stopped. Call sites are lines in class-wp-html-processor.php of each checkout.
| Reason | Target | PR | Δ | Target call sites | PR call sites |
|---|---|---|---|---|---|
Content outside of HTML is unsupported. |
3,015 | 3,015 | 0 | L4690 (3015) | L4690 (3015) |
Cannot run adoption agency when "any other end tag" is required. |
745 | 745 | 0 | L6146 (745) | L6146 (745) |
Cannot reconstruct active formatting elements when advancing and rewinding is required. |
305 | 305 | 0 | L5938 (305) | L5938 (305) |
Cannot extract common ancestor in adoption agency algorithm. |
194 | 194 | 0 | L6198 (194) | L6198 (194) |
Content outside of BODY is unsupported. |
193 | 193 | 0 | L4401 (193) | L4401 (193) |
Cannot process elements after HEAD which reopen the HEAD element. |
179 | 179 | 0 | L2268 (179) | L2268 (179) |
Foster parenting is not supported. |
159 | 159 | 0 | L3506 (14), L3688 (145) | L3506 (14), L3688 (145) |
Cannot close a FORM when other elements remain open as this would throw off the breadcrumbs for the following tokens. |
96 | 96 | 0 | L2791 (96) | L2791 (96) |
Example documents for each reason
| Reason | URL | Size | Call site | Token | Context | Bytes | Breadcrumbs |
|---|---|---|---|---|---|---|---|
Content outside of HTML is unsupported. |
https://medor.no-ip.org/index.php?dir=Skins/&md5=barret.jpg |
671 B | L4690 | <!-- Powered by AutoIndex PHP Script (version 2.2.4) Co… |
…e57fbca295</p></body></html> <!-- Powered by A…rceforge.net --> |
532–669 | HTML > BODY |
https://connect.efsa.europa.eu/RM/s/consultations/publicconsultationfeedback/a0a7U000002FKHCQA4/pcf… |
2 KiB | L4690 | <!-- Body events --> |
…ript> </head> </html> <!-- Body events --> <script type="text/javascript… |
908–928 | HTML > BODY |
|
https://xn--80aahvkuapc1be.xn--p1ai/raznoe/cveta-interneta-bezopasnye-ili-web-safe-cveta-dlya-veb-d… |
2 KiB | L4690 | <!--wdm--> |
… });</script></body></html> <!--wdm--> |
2,089–2,099 | HTML > BODY |
|
Cannot run adoption agency when "any other end tag" is required. |
http://howardianlnr.org.uk/animalsslowworm.html |
2 KiB | L6146 | </i> |
…ne</i></b></center></font><p> </i></b></center></font><p> <cente… |
1,660–1,664 | … > CENTER > TABLE > TBODY > TR > TD > P |
https://lists.freebsd.org/archives/freebsd-doc/2022-December/002979.html |
2 KiB | L6146 | </strong> |
…Sun, 11 Dec 2022 20:05:33 UTC </strong><br> <pre class="main">htt… |
1,188–1,197 | HTML > BODY > ARTICLE |
|
https://kap.ssk.in.th/ceo74/ceo_new_slist.php?ceo=mg2 |
6 KiB | L6146 | </a> |
…indow.close()" value="ปิดหน้านี้"></a> <table width="700" cellpaddi… |
939–943 | HTML > BODY > CENTER |
|
Cannot reconstruct active formatting elements when advancing and rewinding is required. |
https://www.agirregabiria.net/la96.htm |
2 KiB | L5938 | |
…ampliada pr?ximamente..."></p> </a></td> <td width="34%">… |
1,587–1,595 | … > BODY > FONT > TABLE > TBODY > TR > TD |
https://www.zzz.cz/cesty/obrazek.php/2802057 |
3 KiB | L5938 | |
… <br> <center> <img src="/cesty/turecko09/ist… |
1,229–1,247 | … > CENTER > TABLE > TBODY > TR > TD > CENTER |
|
https://www.szentimregyor.hu/jdoc4/index.php/galeria/214-ministranstabor-2012/detail/7893-img5278?t… |
6 KiB | L5938 | |
…"Következő kép" /></div></div> </td> <td valign="top" class="… |
5,807–5,808 | … > BODY > DIV > TABLE > TBODY > TR > TD |
|
Cannot extract common ancestor in adoption agency algorithm. |
https://nndb.com/geo/283/000131887/ |
6 KiB | L6198 | </font> |
…=submit value="Search"> </font></b></nobr></form></td> </tr… |
2,926–2,933 | … > TR > TD > B > FONT > FORM > NOBR |
http://programujte.com/profil/25502/reputace/ |
6 KiB | L6198 | <a href="profil/25502-mytamhuyet/" class="strong nounderlin… |
… <h1>Reputace uživatele <a href="profil/2550…t/';return false;">mytamhuyet</a></h1> <d… |
5,124–5,300 | HTML > BODY > A > DIV > H1 |
|
http://store.comicfusion.net/nov063168.html |
10 KiB | L6198 | </font> |
…licy.html">Privacy Policy</a> </font> <br> <br> <br> We accept:<br>… |
5,570–5,577 | … > TR > TD > FONT > CENTER > FONT > P |
|
Content outside of BODY is unsupported. |
https://acikerisim.gelisim.edu.tr/browse/author?startsWith=Ferhatoglu,%20Murat%20Ferhat |
751 B | L4401 | <!-- do not include client bundle, it is injected with Zone… |
…pe="module"></script></body> <!-- do not include … already loaded --> </html> |
663–741 | HTML > BODY |
https://repositorio.ufla.br/browse/author?startsWith=Cabral,%20Rosa%20Maria |
751 B | L4401 | <!-- do not include client bundle, it is injected with Zone… |
…pe="module"></script></body> <!-- do not include … already loaded --> </html> |
663–741 | HTML > BODY |
|
https://repozytorium.amu.edu.pl/collections/5eba6b75-5ae6-4ac1-aeb7-f6572c357f9c/browse/subject |
789 B | L4401 | <!-- do not include client bundle, it is injected with Zone… |
…pe="module"></script></body> <!-- do not include … already loaded --> </html> |
701–779 | HTML > BODY |
|
Cannot process elements after HEAD which reopen the HEAD element. |
https://www.interfax-russia.ru/northwest/turisticheskaya-stolica/pulkovo-obsuzhdaet-s-kitayskimi-av… |
2 KiB | L2268 | <script src="https://servicepipe.tech/loaders/cbb87dd654aa2… |
…0, user-scalable=no"> </head> <script src="https:/…us" async></script> <style> .spinner-container … |
296–482 | HTML |
https://www.brucespringsteen.it/DB/detrec.aspx?code=COL13032432 |
3 KiB | L2268 | <script language="JavaScript" src = "libmnx.js"></script> |
…base target="_self"> </head> <script language="Ja…ibmnx.js"></script> <body background="../image… |
621–678 | HTML |
|
https://geocaching.hu/images.geo?id=480022&group=351303&table=log_images&wi=600&he=450 |
7 KiB | L2268 | <script language="JavaScript" type="text/javascript"> fun… |
…Trans(Duration=0.1)"> </head> <script language="Ja…ght); } </script> <script src="https://ajax.go… |
513–2,145 | HTML |
|
Foster parenting is not supported. |
http://hsgoods.co.kr/shop/shop.htm?type=brand_end_bbs&brandcode=03600000000000000026 |
5 KiB | L3688 | </form> |
… </td> </tr> </form> </table> </td> </tr> </… |
4,061–4,068 | … > TABLE > TBODY > TR > TD > TABLE > TBODY |
http://richmond.nygenweb.net/cgi-bin/mail.php?sur=HENDELL&vol=Janet |
6 KiB | L3688 | <BR> |
…hmond County Surname HENDELL"><BR> <TR><TD valign="top"><B>Messa… |
5,288–5,292 | … > TBODY > TR > TD > FORM > TABLE > TBODY |
|
http://www.klausheidersc.de/fotos/?galerie=90&bild=44 |
6 KiB | L3688 | <map name="open"> |
…usemap="#open"/></td> <map name="open"> <area shape="rect" c… |
2,766–2,783 | … > DIV > DIV > DIV > TABLE > TBODY > TR |
|
Cannot close a FORM when other elements remain open as this would throw off the breadcrumbs for the following tokens. |
https://koreamed.org/SearchBasic.php?QY=%28%22Bozkurt+G%22%5BAU%5D%29 |
11 KiB | L2791 | </form> |
… </ul> </fieldset> </form> <p class="selector" style… |
8,618–8,625 | HTML > BODY > DIV > DIV > FORM > DIV |
https://biurorealnet.pl/wojewodztwo-lubuskie-Nieruchomosci,,,0,0,4,0.html |
13 KiB | L2791 | </form> |
…it" value="Szukaj"/> </div> </form> </section> <nav id="main… |
6,018–6,025 | HTML > BODY > DIV > HEADER > FORM > SECTION |
|
https://tqqq.site/payback.php?table_name=sp500_code&ticker_market=sp500_&ticker=FITB&ticker_name=FI… |
21 KiB | L2791 | </form> |
…btn-lg" value="계산하기" > </form> <br> *종목중 액면병합,액면… |
14,885–14,892 | … > DIV > DIV > FORM > DIV > DIV > DIV |
- Newly unsupported with this PR: 0
- Newly supported with this PR: 0
- Unsupported for a different reason with this PR: 0
| if ( '>' === $this->html[ $this->bytes_already_parsed ] ) { | ||
| if ( $skipped_length > 0 && '/' === $this->html[ $this->bytes_already_parsed - 1 ] ) { | ||
| $this->has_self_closing_flag = true; | ||
| while ( true ) { |
There was a problem hiding this comment.
if I had some example of this before I apologize: let’s never leave un-conditioned loops. we can add a budget of a reasonably high limit, such as 10,000
$budget = 10000;
while ( --$budget ) {
}ideally we base this off of some real condition though, preferring to terminate the loop when the data suggests it. this is an embedded guard against accidental infinite looping.
| * | ||
| * @return bool Whether an attribute was found. Returns `false` upon reaching the end | ||
| * of the tag (`>` or `/>`) or the end of the document. | ||
| * @since 7.3.0 |
There was a problem hiding this comment.
Since 7.2.0 is in beta, I think it’s too late to add enhancements. There’s no bug here, so this isn’t a fix.
Replace the private
parse_next_attribute()loop withparse_all_attributes(). It stops at the tag's closing>or setsSTATE_INCOMPLETE_INPUT, removing duplicate checks in callers.Skip whitespace scans when
=immediately follows an attribute name or a quote immediately follows=. This is a fast path for the most common attributes likeattr="val"where there is no whitespace surrounding the=.Benchmarks show about 10% less Tag Processor parsing time with tracing JIT and 9% without; the loop refactor alone saves about 4%. The HTML Processor shows no measured difference. These results use
next_token()on 32 documents (19 real pages, 13 synthetic), PHP 8.5.12. The current PR head was not benchmarked.Trac ticket: https://core.trac.wordpress.org/ticket/65984
Use of AI Tools
AI assistance: Yes.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.