Skip to content

[3.0] Improve performance of XmlArraty#9187

Open
live627 wants to merge 14 commits intoSimpleMachines:release-3.0from
live627:perf/xml
Open

[3.0] Improve performance of XmlArraty#9187
live627 wants to merge 14 commits intoSimpleMachines:release-3.0from
live627:perf/xml

Conversation

@live627
Copy link
Copy Markdown
Contributor

@live627 live627 commented Apr 16, 2026

One of the main things slowing down the package lists is our XML parser. I have identified several repeated operations and have fixed them to not repeat as much.

The final commit needs a little more testing because I couldn’t test installing a mod due to my built cURL extension not working right.

Copy link
Copy Markdown
Member

@Sesquipedalian Sesquipedalian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review

Comment thread Sources/PackageManager/XmlArray.php Outdated
Comment on lines +572 to +584
$indentation = $indent !== null ? '
' . str_repeat(' ', $indent) : '';
static $indentation_cache;

$indentation_cache ??= $indent !== null
? "\n" . str_repeat("\t", $indent)
: '';
$indentation = $indentation_cache;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this works. $indentation is supposed to be set to a number of tabs equal to the value of $indent, but this change will set $indentation only on the first call to the method and then ignore $indent in any subsequent calls.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh you''re right. I'll revert this one; static cache here probably not worth the effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants