#43891 closed enhancement (invalid)
Performance improvement for WP_Query
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | Query | Keywords: | has-patch needs-testing |
| Focuses: | Cc: |
Description
WP_Query has some(10 I think) use of reset() function. But it has a performance drawback. So here I'm proposing to replace the PHP native reset() function with class method which will work with foreach() loop.
Here is the benchmark-
http://sandbox.onlinephpfunctions.com/code/d16f2e69944643bd49ad3b2beb4d37ad23a2d742.
Attachments (1)
Change History (5)
#1
@
8 years ago
- Keywords reporter-feedback added; 2nd-opinion dev-feedback removed
- Severity changed from major to normal
- Version trunk deleted
Thanks for the ticket and the patch, @rnaby, but I think your benchmarks are flawed. If you add judge($a, 'reset'); to the end of the test (after judge($a, '_reset'); you'll see that directly calling reset() is faster than the other methods. Your _reset() function incurs overhead that the reset() function doesn't.
Can you confirm?
Note: See
TracTickets for help on using
tickets.
The patch for the issue.