Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance improvement in Requests.php compatible_gzinflate() function #152

Open
adam-pro opened this issue Apr 24, 2015 · 0 comments
Open

Comments

@adam-pro
Copy link

Regarding function: compatible_gzinflate()

LINES 834 to 838 read:

834    // Fallback for all above failing, not expected, but included for
835    // debugging and preventing regressions and to track stats
836    if ( false !== ( $decompressed = @gzinflate( substr( $gzData, 2 ) ) ) ) {
837      return $decompressed;
838    }

However, the code at 836 to 838 may already have been attempted on Lines 797 to 799 in the event that $huffman encoded is TRUE.

796    if ( $huffman encoded ) {
797      if ( false !== ( $decompressed = @gzinflate( substr( $gzData, 2 ) ) ) ) 
798        return $decompressed;
799    }

Accordingly the PERFORMANCE of Lines 834 to 838 can be improved by preceding Line 836 with an additional test:

new    if ( ! $huffman encoded) {
836      if ( false !== ( $decompressed = @gzinflate( substr( $gzData, 2 ) ) ) ) {
837        return $decompressed;
838      }
new    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant