WordPress / WordPress/Requests
Performance issue with Requests.php decompress() / compatible_gzinflate() functions
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 500
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 5
Description
Currently the function: decompress() speculatively attempts the following in turn:
- gzdecode(...)
- gzinflate(...)
- self::compatible_gzinflate(...)
- gzuncompress(...)
However, #3 compatible_gzinflate(...) includes within it (at Lines 834 to 838) a "fallback" call to gzinflate(...) which is identical to that attempted at #2.
Hence if #2 fails. it may be uselessly repeated within #3.
One solution may be to do BOTH the following:
- MOVE the "fallback" in compatible_gzinflate(...) to the beginning of that function (i.e. make it the first inflation attempted), and
- REMOVE from decompress() function the gzinflate(...) attempt at #2.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Requests.php by reading decompress() and compatible_gzinflate(), especially the fallback around lines 834–838. Confirm how the repeated gzinflate() attempt is reached, then make the call-order change without altering the other decompression fallbacks and verify the existing test suite.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- networking
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100