Closed
Conversation
Contributor
|
This pull request has been imported into Phabricator, and discussion and review of the diff will take place at https://reviews.facebook.net/D40473 |
9160446 to
9ce1122
Compare
cda3307 to
7f982d7
Compare
10deab1 to
2427448
Compare
strtr() invoked with an array $replace_pairs as the second argument appears to perform much worse under HHVM than PHP5. PHP's implementation of multiple-string search was formerly quite naïve, and it was the subject of PHP bug 63893. In 2013, it was rewritten to utilize a clever and efficient algorithm for multi-pattern searching (Wu-Manber), and then further optimized. It looks like HHVM's implementation is based on the naive implementation PHP sported before PHP 5.4, which explains the poor performance. This patch ports over the strtr implementation in php 5.6.10. This implementation prefers the existing strtr_fast algorithm and falls back to wu-manber when there are too many patterns.
2427448 to
bc75a7e
Compare
Contributor
|
@ebernhardson can you have a look at #6384 please? It seems likely this change is the cause of that crash. I'm going to spend some time later to confirm, but if it is, we'll have to revert it if you don't send a PR soonish to fix it. |
Contributor
|
#6395 is a proposed fix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #5471
strtr() invoked with an array $replace_pairs as the second argument appears to
perform much worse under HHVM than PHP5.
PHP's implementation of multiple-string search was formerly quite naïve, and it
was the subject of PHP bug 63893. In 2013, it was rewritten to utilize a clever
and efficient algorithm for multi-pattern searching (Wu-Manber), and then
further optimized. It looks like HHVM's implementation is based on the naive
implementation PHP sported before PHP 5.4, which explains the poor performance.
This patch ports over the strtr implementation in php 5.6.10.