Commit 1edee76
committed
(improvement): perf - eliminate reflection overhead for collection and tuple types
Similiar to previous commit:
Add type-specific fast paths in CollectionType.NewWithError() and
TupleTypeInfo.NewWithError() to avoid expensive reflection calls during
row data allocation.
Changes:
- CollectionType.NewWithError(): Fast paths for common patterns:
* Lists/sets: []int, []int64, []string, []bool, []float32, []float64,
[]UUID, []time.Time, []int16, []int8, [][]byte
* Maps: map[string]int, map[string]int64, map[string]string,
map[string]bool, map[string]float64, map[string]UUID,
map[int]string, map[int]int
* Falls back to reflection for complex nested collections
- TupleTypeInfo.NewWithError(): Simplified to always return
new([]interface{}) since tuples unmarshal to []interface{} regardless
of element types, completely eliminating reflection
(Note - we may need to think of moving from interface to any? )
Performance impact:
- Tuple-heavy queries: ~3% faster (1047→1017 ns/op)
- Maintains performance for primitive-heavy workloads
- Part of broader RowData() optimization series:
* Combined improvements: 58.7% faster overall
* Memory: -44% (720→400 B/op)
* Allocations: -45% (22→12 allocs/op)
Benchmarks show targeted benefits for queries using collections and
tuples while preserving fast-path performance for queries dominated by
native types.
Signed-off-by: Yaniv Kaul <yaniv.kaul@scylladb.com>1 parent f124115 commit 1edee76
2 files changed
+126
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
227 | 228 | | |
228 | 229 | | |
229 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1817 | 1817 | | |
1818 | 1818 | | |
1819 | 1819 | | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 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 | + | |
1820 | 1885 | | |
1821 | 1886 | | |
1822 | 1887 | | |
| |||
1861 | 1926 | | |
1862 | 1927 | | |
1863 | 1928 | | |
1864 | | - | |
1865 | | - | |
1866 | | - | |
1867 | | - | |
1868 | | - | |
| 1929 | + | |
| 1930 | + | |
1869 | 1931 | | |
1870 | 1932 | | |
1871 | 1933 | | |
| |||
0 commit comments