libct/cg/sd: optimize and test findDeviceGroup#3357
libct/cg/sd: optimize and test findDeviceGroup#3357thaJeztah merged 1 commit intoopencontainers:mainfrom
Conversation
ddccea2 to
94e14c8
Compare
94e14c8 to
bdd51d9
Compare
bdd51d9 to
c12d83f
Compare
c12d83f to
ed71681
Compare
|
Rebased, dropped the commit which contained optimization which did not resulted in any noticeable improvement. @cyphar @thaJeztah PTAL |
ed71681 to
63e5028
Compare
|
@thaJeztah sorry to bother you, I have just updated the commit to remove most of bytes-related ugliness. Apparently, in modern Go versions, using bytes instead of strings does not result in any performance gain (it used to be the case, but appears to be fixed now). The performance gain (and drastically reduced number of allocations) comes from ditching fmt.Sscanf which is apparently not implemented very well. The new patch is much smaller and focused, PTAL. |
|
Oh! Interesting that they improved that; good to know! |
|
@AkihiroSuda @cyphar PTAL |
63e5028 to
ef886e1
Compare
ef886e1 to
d040bf9
Compare
somehow your LGTM got lost @thaJeztah; PTA(nother)L |
d040bf9 to
842c131
Compare
ed02291 to
06f67e9
Compare
06f67e9 to
1228258
Compare
|
@thaJeztah you have previously LGTMed this; PTAAL |
1228258 to
a9ed27c
Compare
1. Use strings.TrimPrefix instead of fmt.Sscanf and simplify the code. 2. Add a test case and a benchmark. The benchmark shows some improvement, compared to the old implementation: name old time/op new time/op delta FindDeviceGroup-4 39.7µs ± 2% 26.8µs ± 2% -32.63% (p=0.008 n=5+5) name old alloc/op new alloc/op delta FindDeviceGroup-4 6.08kB ± 0% 4.23kB ± 0% -30.39% (p=0.008 n=5+5) name old allocs/op new allocs/op delta FindDeviceGroup-4 117 ± 0% 6 ± 0% -94.87% (p=0.008 n=5+5) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
a9ed27c to
defb1cc
Compare
|
Rebased; @opencontainers/runc-maintainers PTAL |
This includes/depends on #3356, draft until merged.Using strings.TrimPrefix instead of fmt.Sscanf.
Add a test case and a benchmark.
The benchmark shows some improvement, compared to the old
implementation: