mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
microptimization of SQLite3Result::fetchArray
Store the result of sqlite3_data_count() into a variable and check that inside a loop instead calling it directly all the time. GCC is not brave enough to figure out the function produces the same result every time and call it repeatedly. This change produces fairly small but measurable and consistent speedup.
This commit is contained in:
parent
1347d90a23
commit
f6d30cfba7
1 changed files with 3 additions and 1 deletions
|
@ -1946,8 +1946,10 @@ PHP_METHOD(SQLite3Result, fetchArray)
|
|||
}
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
int column_count = sqlite3_data_count(result_obj->stmt_obj->stmt);
|
||||
|
||||
for (i = 0; i < sqlite3_data_count(result_obj->stmt_obj->stmt); i++) {
|
||||
for (i = 0; i < column_count; i++) {
|
||||
zval data;
|
||||
|
||||
sqlite_value_to_zval(result_obj->stmt_obj->stmt, i, &data);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue