Skip to content

Commit 88393cf

Browse files
committed
Fix GH-13988: Storing DOMElement consume 4 times more memory in PHP 8.1 than in PHP 8.0
We avoid creating backing storage by using the feature introduced in f78d5cf. Closes GH-15593.
1 parent 16d4fb1 commit 88393cf

File tree

8 files changed

+750
-324
lines changed

8 files changed

+750
-324
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.4.0beta5
44

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

69
27 Aug 2024, PHP 8.4.0beta4
710

UPGRADING

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,7 @@ PHP 8.4 UPGRADE NOTES
10831083
an xpath query. This can give a time improvement of easily two order of
10841084
magnitude for documents with tens of thousands of nodes.
10851085
. Improved performance and reduce memory consumption of XML serialization.
1086+
. Reduced memory usage of node classes.
10861087

10871088
- FTP:
10881089
. Improved the performance of FTP uploads up to a factor of 10x for large

ext/dom/element.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ URL: https://dom.spec.whatwg.org/#dom-element-classlist
182182
*/
183183
zend_result dom_element_class_list_read(dom_object *obj, zval *retval)
184184
{
185-
const uint32_t PROP_INDEX = 20;
185+
const uint32_t PROP_INDEX = 0;
186186

187187
#if ZEND_DEBUG
188188
zend_string *class_list_str = ZSTR_INIT_LITERAL("classList", false);

ext/dom/html_document.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ typedef struct dom_decoding_encoding_ctx {
8383
/* https://dom.spec.whatwg.org/#dom-document-implementation */
8484
zend_result dom_modern_document_implementation_read(dom_object *obj, zval *retval)
8585
{
86-
const uint32_t PROP_INDEX = 14;
86+
const uint32_t PROP_INDEX = 0;
8787

8888
#if ZEND_DEBUG
8989
zend_string *implementation_str = ZSTR_INIT_LITERAL("implementation", false);

0 commit comments

Comments
 (0)