PHPDS_query asWhole can be performance tuned
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
PHPDevShell |
Fix Committed
|
High
|
Don Schoeman |
Bug Description
PHPDS_query's asWhole() function is called when multiple rows are requested from the database and it returns a big array of arrays as the result. The function is called multiple times on nearly every page. The asWhole() function can also do extra manipulation on the data based on the keyField and focus optional parameters. However, both the KeyField and focus options are used in very rare occasions within PHPDevshell itself, yet, a number of unnecessary assignments and conditional checks are performed on each row of the result set regardless of the KeyField and focus options.
This function can be optimised by first checking whether the keyField or focus parameter is set. If none of the two parameters is set it can then loop through the result set much more efficiently.
Related branches
Changed in phpdevshell: | |
status: | New → Fix Committed |
Changed in phpdevshell: | |
milestone: | 3.2.1-stable → 3.5 |
I agree but you have to be very careful on how to decide to skip the loop.