modernize, cleanup, prevent unnessecary valCopies.#2440
modernize, cleanup, prevent unnessecary valCopies.#2440the-hotmann wants to merge 1 commit intojackc:masterfrom
Conversation
|
I also fixed all shadow-imports like "sql" (named it Here: I would like to ask for your attention: https://github.com/jackc/pgx/blob/master/pgtype/int.go#L1173 As for me this seems to be a bug: It checks against |
|
@jackc if you like I can break this PR down into multiple PRs based on the optimizations:
... if that would help |
|
This would definitely need to be broken up into multiple, maybe even many, separate PR's. I did look at it but However, I did notice several types of changes that I'm not optimistic about: Changing loops to use indexes instead of the value. e.g. for _, bi := range b.QueuedQueries {
sc.Invalidate(bi.SQL)to for i := range b.QueuedQueries {
sc.Invalidate(b.QueuedQueries[i].SQL)I find the former easier to read. Changing benchmarks to use Renaming variables like Changing the function arguments or return values from values to pointers is a breaking change. We can't do that. e.g. |
@jackc Could you please rerun all tests and benchmarks to confirm there are no flaky results?
I’ve applied a lot of optimizations, so the package should now have significantly fewer allocations.
Additionally, I included a number of other improvements.
I skipped many that would degrade DX and have not touched the structure of the structs, even though I think there is a lot to improve:
Anyway feel free to criticize :)