Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhancement: Avoid calling reflect.New() when passing in slice of val…
…ues to `Scan()` (#5388) * fix: reduce allocations when slice of values * chore[test]: Add benchmark for scan * chore[test]: add bench for scan slice * chore[test]: add bench for slice pointer and improve tests * chore[test]: make sure database is empty when doing slice tests * fix[test]: correct sql delete statement * enhancement: skip new if rows affected = 0
- Loading branch information
1 parent
f4e9904
commit d01de72
Showing
2 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d01de72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pointer in a struct will be copied when append recyclableStruct to the slice.
For example
All users in the slice will point to the same instance of Manager and the Manager is populated with data from last user's manager.
d01de72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a model defines like BusProduct will get the same model when querying
here is part of my log
d01de72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed an issue for this change in behavior: #5575