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

Benchmark transition to native PHP 8.4 HTMLDocument #459

Open
g105b opened this issue Mar 7, 2025 · 1 comment
Open

Benchmark transition to native PHP 8.4 HTMLDocument #459

g105b opened this issue Mar 7, 2025 · 1 comment
Assignees
Labels
enhancement Improvement to existing functionality feature New functionality idea

Comments

@g105b
Copy link
Member

g105b commented Mar 7, 2025

The release of PHP 8.4 introduces much improved native DOM functionality. https://www.php.net/manual/en/class.dom-htmldocument.php

This should make a lot of GT's Dom redundant, and should increase speed due to it being native bindings.

However, it will be impossible to switch to the new native functionality without some work, and the work is imposed on GT along with other users of the DOM - all new native DOM classes are final. This means that GT DOM might have to take the decision to go back to proxying the native classes, rather than extending them, so that the GT classes can be used and extended by DomTemplate, and other projects.


Before any transition work can start, a benchmark needs to be defined, so we know what we're aiming for.

This should only be a few simple scripts that work with large documents or repetitive tasks on the smaller documents, but each script should run twice: once with the GT Dom, and once with the new native Dom. The actual code should be identical for both tests - in fact, there could be a dynamic instantiation of each class within the same script.

@g105b g105b added enhancement Improvement to existing functionality feature New functionality idea labels Mar 7, 2025
@g105b g105b self-assigned this Mar 7, 2025
g105b added a commit that referenced this issue Mar 7, 2025
@g105b
Copy link
Member Author

g105b commented Mar 7, 2025

See benchmarks introduced in bc964a1 - over 90% speed increase, with no change required to the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement to existing functionality feature New functionality idea
Projects
None yet
Development

No branches or pull requests

1 participant