Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML API: Plans for 6.8 #63037

Open
12 tasks
dmsnell opened this issue Jul 1, 2024 · 0 comments
Open
12 tasks

HTML API: Plans for 6.8 #63037

dmsnell opened this issue Jul 1, 2024 · 0 comments
Labels
[Feature] HTML API An API for updating HTML attributes in markup [Type] Iteration Scoped iteration of an effort from a tracking issue or overview issue ideally for a major release.

Comments

@dmsnell
Copy link
Member

dmsnell commented Jul 1, 2024

🔝Block API | HTML issues | Refactors | ↑ Broader Roadmap | ← Plans for 6.7

Potential HTML rule changes.

Lingering work from 6.7

  • Speed speed speed. Make the HTML Processor 10x faster.

    • Can we defer parsing and deduplicating attribute names while parsing tags and only start doing that when reading attributes?
      • Potentially around a 3% speed improvement in scanning tokens with the Tag Processor when not interacting with attributes.
    • Remove all if statements that don't execute anything (they have a comment as their body).
    • If 6.7 includes full support for all HTML tags, measure the impact of reordering the case statements in each insertion mode. Test against 100s of 1000s of websites based on web popularity.
    • Profile the parsing of 100s of 1000s of websites and see if anything surprising pops up in the results.
    • Replace '#text' === $token_type with ::STATE_TEXT_NODE === $this->parser_state
    • Eagerly set token name, type in step() where all nodes are real. Reference these values instead of calling ->get_token_name() etc…
    • Remove after_element_push() since these are all instigated from within the HTML Processor, unlike pop with pop_until() (unless we made pop_until() return a generator and we could foreach ( $state->pop_until( 'TAG' ) as $popped )
    • Flagification
      • Replace as many repetitive if checks with flags that are set on events, as is done with has_p_in_button_scope.
      • Indicate once in next_token() if a text node is only whitespace.
  • Following the change to push/pop, immediately pop elements off of the stack of elements as instructed in the parsing rules, vs. letting step() perform the check and pop.

With some initial explorations I've found 16% - 40% speed improvement with some of these ideas. That's not good enough, but it's a start.

Lingering support edge-cases.

New Features and Interfaces

Blocks

  • Continue developing block attribute sourcing.
  • Iterate on the Server Directive Processor.
  • Iterate on the Block Bindings processor.
@dmsnell dmsnell added [Feature] HTML API An API for updating HTML attributes in markup [Type] Iteration Scoped iteration of an effort from a tracking issue or overview issue ideally for a major release. labels Jul 1, 2024
This was referenced Jul 1, 2024
@gziolo gziolo mentioned this issue Oct 10, 2024
67 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] HTML API An API for updating HTML attributes in markup [Type] Iteration Scoped iteration of an effort from a tracking issue or overview issue ideally for a major release.
Projects
None yet
Development

No branches or pull requests

1 participant