Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added NullUniqueIdentifier struct to work with GUIDs that can be null #635

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

eduolalo
Copy link

@eduolalo eduolalo commented Feb 2, 2021

I'm working with the excecution of stored procedures, if the execution generates an transaction the answer will include a GUID, if it do not generates an transaction it does not mean there is an error, so I can or can't receive an unique identifier, thats why I think would be nice to include this data type in this proyect.

@codecov
Copy link

codecov bot commented Feb 2, 2021

Codecov Report

Merging #635 (a8491d9) into master (045585d) will decrease coverage by 0.01%.
The diff coverage is 77.27%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #635      +/-   ##
==========================================
- Coverage   71.98%   71.97%   -0.02%     
==========================================
  Files          24       25       +1     
  Lines        5469     5491      +22     
==========================================
+ Hits         3937     3952      +15     
- Misses       1309     1314       +5     
- Partials      223      225       +2     
Impacted Files Coverage Δ
nulluniqueidentifier.go 77.27% <77.27%> (ø)
tds.go 67.21% <0.00%> (-0.39%) ⬇️
token.go 61.08% <0.00%> (+0.15%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 045585d...a8491d9. Read the comment docs.

}

err := nui.UniqueIdentifier.Scan(v)
if err != nil {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting any possible scan error into a Null value doesn't seem right to me, error checking should be more specific

ninjadq pushed a commit to ninjadq/go-mssqldb that referenced this pull request May 28, 2024
Optimize In performance by reducing allocations for common queries
ninjadq pushed a commit to ninjadq/go-mssqldb that referenced this pull request May 28, 2024
The changes in denisenkom#635 changed the some of the output types of In to
pointers.  This takes less time but it also changed the types in the
output of In in a way that I think is more aggressive than I would have
preferred.  I'm also not 100% convinced that using pointers to types like
`int` and `string` would provide an overall performance benefit when you
factor in GC.

Despite that, timings did get worse:

pre-change:

```
BenchmarkIn-4                3136129               376 ns/op             272
B/op           4 allocs/op
BenchmarkIn1k-4                   171588              6602 ns/op
19488 B/op             3 allocs/op
BenchmarkIn1kInt-4                157549              7502 ns/op
19488 B/op             3 allocs/op
BenchmarkIn1kString-4             155502              7604 ns/op
19488 B/op             3 allocs/op
```

post-change:

```
BenchmarkIn-4                    3007132               396 ns/op
272 B/op               4 allocs/op
BenchmarkIn1k-4                   175978              6768 ns/op
19488 B/op             3 allocs/op
BenchmarkIn1kInt-4                120422             10125 ns/op
19488 B/op             3 allocs/op
BenchmarkIn1kString-4             108813             10755 ns/op
19488 B/op             3 allocs/op
```

I'd prefer to keep `[]int{..}` producing ints instead of `*int` even if
it means losing ~25% of perf on these special cased functions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants