query: binary encoder for repo branches (#53)
We implement a custom binary marshaller for a list of repos to
branches. When profiling Sourcegraph this is one of the dominant items
and this provides a significant improvement.
Note: This commit does not provide a way to roll this change out. I
investigated if this was possible with Gob and its pretty
difficult. This means that while Sourcegraph and Zoekt are out of sync
searches will fail. I am unsure if its worth making this smooth to
rollout.
name old time/op new time/op delta
RepoBranches_Encode-8 2.37ms ± 3% 0.62ms ± 0% -73.77% (p=0.000 n=10+8)
RepoBranches_Decode-8 4.19ms ± 2% 0.74ms ± 1% -82.37% (p=0.000 n=10+9)
name old bytes new bytes delta
RepoBranches_Encode-8 393kB ± 0% 344kB ± 0% -12.48% (p=0.000 n=10+10)
name old alloc/op new alloc/op delta
RepoBranches_Encode-8 726kB ± 0% 344kB ± 0% -52.60% (p=0.000 n=10+9)
RepoBranches_Decode-8 2.31MB ± 0% 1.44MB ± 0% -37.51% (p=0.000 n=9+10)
name old allocs/op new allocs/op delta
RepoBranches_Encode-8 20.0k ± 0% 0.0k ± 0% -100.00% (p=0.000 n=10+10)
RepoBranches_Decode-8 50.6k ± 0% 0.4k ± 0% -99.26% (p=0.000 n=10+10)