Skip to content

Commit

Permalink
Fix GH-13988: Storing DOMElement consume 4 times more memory in PHP 8…
Browse files Browse the repository at this point in the history
….1 than in PHP 8.0

We avoid creating backing storage by using the feature introduced in
f78d5cf.

Closes GH-15593.
  • Loading branch information
nielsdos committed Aug 27, 2024
1 parent 16d4fb1 commit 88393cf
Show file tree
Hide file tree
Showing 8 changed files with 750 additions and 324 deletions.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.4.0beta5

- DOM:
. Fixed bug GH-13988 (Storing DOMElement consume 4 times more memory in
PHP 8.1 than in PHP 8.0). (nielsdos)

27 Aug 2024, PHP 8.4.0beta4

Expand Down
1 change: 1 addition & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,7 @@ PHP 8.4 UPGRADE NOTES
an xpath query. This can give a time improvement of easily two order of
magnitude for documents with tens of thousands of nodes.
. Improved performance and reduce memory consumption of XML serialization.
. Reduced memory usage of node classes.

- FTP:
. Improved the performance of FTP uploads up to a factor of 10x for large
Expand Down
2 changes: 1 addition & 1 deletion ext/dom/element.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ URL: https://dom.spec.whatwg.org/#dom-element-classlist
*/
zend_result dom_element_class_list_read(dom_object *obj, zval *retval)
{
const uint32_t PROP_INDEX = 20;
const uint32_t PROP_INDEX = 0;

#if ZEND_DEBUG
zend_string *class_list_str = ZSTR_INIT_LITERAL("classList", false);
Expand Down
2 changes: 1 addition & 1 deletion ext/dom/html_document.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ typedef struct dom_decoding_encoding_ctx {
/* https://dom.spec.whatwg.org/#dom-document-implementation */
zend_result dom_modern_document_implementation_read(dom_object *obj, zval *retval)
{
const uint32_t PROP_INDEX = 14;
const uint32_t PROP_INDEX = 0;

#if ZEND_DEBUG
zend_string *implementation_str = ZSTR_INIT_LITERAL("implementation", false);
Expand Down
Loading

0 comments on commit 88393cf

Please sign in to comment.