Skip to content

Commit 4665296

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.
1 parent baac01f commit 4665296

File tree

7 files changed

+747
-324
lines changed

7 files changed

+747
-324
lines changed

UPGRADING

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

10811082
- FTP:
10821083
. 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)