Skip to content

ext/standard: Convert levenshtein to fast ZPP - #24369

Merged
LamentXU123 merged 1 commit into
php:masterfrom
LamentXU123:standard20261016
Oct 16, 2026
Merged

LamentXU123 merged 1 commit into
php:masterfrom
LamentXU123:standard20261016

Conversation

@LamentXU123

Copy link
Copy Markdown
Member

No description provided.

@iliaal

iliaal commented Oct 16, 2026

Copy link
Copy Markdown
Member

Fast ZPP inlines the parsing into every function, so it's only worth the extra code size on hot paths. The DNS functions are dominated by the network round trip, and the base php_user_filter::filter() just returns PSFS_ERR_FATAL, so these conversions grow the binary with no gain. levenshtein() is the only arguable one here, and even there the O(n*m) loop dwarfs argument parsing. I'd drop this.

@LamentXU123

Copy link
Copy Markdown
Member Author

I see, haven't thought in this point of view.
In this case I'd say levenshtein is worth the change because it brings performance improvements to short strings wdyt? I benchmark it and it shows like ~38% increasement in single char and ~16% increasement in common words like "apple"
The different in binary size is 473 bytes of the levenshtein change alone

@LamentXU123 LamentXU123 changed the title ext/standard: Convert more functions to fast ZPP ext/standard: Convert levenshtein to fast ZPP Oct 16, 2026

@iliaal iliaal left a comment

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.

Yeah, if benchmark shows a big uplift, 38% fits that imho just focusing on that gets my +1

@Sjord

Sjord commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Looks good to me.

FAIL torrentzip format support [ext/zip/tests/oo_torrentzip.phpt]

Is this due to #24358?

@LamentXU123

Copy link
Copy Markdown
Member Author

Looks good to me.

FAIL torrentzip format support [ext/zip/tests/oo_torrentzip.phpt]

Is this due to #24358?

Yes. There is nothing to do about it unfortunately. We just need to wait for the mirror to update itself.

@LamentXU123
LamentXU123 merged commit fda3cb0 into php:master Oct 16, 2026
16 of 18 checks passed
@LamentXU123

Copy link
Copy Markdown
Member Author

Thanks!

@LamentXU123
LamentXU123 deleted the standard20261016 branch October 16, 2026 16:09
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.

3 participants