Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upperf: Prevent unnecessary calls to format() #1429
Conversation
Thanks! Unfortunately I'm not comfortable pulling this in due to breaking people's code. For example, I have seen SO answers using the "queryFormat" to alter the SQL (rather than purely inserting the values into the SQL), and of course our documentation in the README implies that "queryFormat" is always called, even when there are no values. Perhaps there is another way to achieve the performance improvement you are trying to get? What is the performance different, anyhow? |
I updated the changes so that the custom |
What if the guard was just directly added within the SqlString.format? Does that still have the same speedup? It would mean that the speed up extends to anyone using our format in any context (for example, using it within queryFormat). |
I'm looking into addressing performance inside
|
Gotcha. I'm afraid for people who have overwritten SqlString.format , which is possible, they would break, and I'm just not confortable breaking them. I can hold this for when 3.0 comes, though. |
By the way, if you have other changes, see if you can PR them this weekend if you would like to see them land in 2.11.0. I need to fix a bug introduced by one of these SqlString optimizations (not one of yours), and then master will be ready for 2.11, so just a heads up for anything else you want to include :) |
Oh wow, I didn't think people would overwrite And I'll have a PR for |
65c4c0c
to
fa96a75
638d79d
to
88bade0
946727b
to
37fbbdd
Currently, the input SQL string is being formatted for every single query, which creates unnecessary overhead when there are no input values to use for formatting. This change prevents
format()
from being called if there is no user input forvalues
(unless the user is using a customqueryFormat
function, which is always called).Benchmark results of calling
connection.query()
with novalues
argumentPR/before
)