Repository navigation
Conversation
consume_ident_like() decoded every identifier to compare it with "url", and used the result only when the next byte is `(`. Checking that byte first skips the decoding for every identifier that is not followed by `(`, which is most of them. Tokenizing the 70 KB stylesheet from the previous commit took 4.9 ms before and 4.5 ms after, best of 10 runs on PHP 8.5. (cherry picked from commit a72493d)
|
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:
|
…okenizer-url-check-order
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Caution
This is a work in progress draft and is not ready for any serious review.
Check for
(before decoding an identifier inconsume_ident_like(). The identifier is compared withurlonly to decide whether a url token follows, which needs(as the next byte. Most identifiers are not followed by(, so the decoding is skipped for them.No behavior changes. The
css-apigroup passes (1007 tests).Tokenizing 257 KB of CSS (
buttons.css,admin-bar.css,dashicons.cssand Twenty Twenty-One'sstyle.css, 51,336 tokens) takes 17.1 ms instead of 18.9 ms: best of 15 runs, one process per variant, three rounds, PHP 8.5. The commit message's numbers and its reference to a previous commit come from a 70 KB stylesheet on the branch where the change was first written; this PR stands alone.Depends on WordPress#14781.
Trac ticket: TBD
Use of AI Tools
AI assistance: Yes
Tools: Claude Code
Models: Claude Opus 5.5
Used for: implementation, measurement and this description.
This pull request is for code review only. Keep other discussion in the Trac ticket. Do not merge. See GitHub Pull Requests for Code Review in the Core Handbook.