Commit 75a7ebf
committed
fixes jmoiron#688
The changes in jmoiron#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.1 parent 4cb7f7d commit 75a7ebf
2 files changed
+42
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
| 252 | + | |
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
| 256 | + | |
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1852 | 1852 | | |
1853 | 1853 | | |
1854 | 1854 | | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
0 commit comments