Repository navigation
Commit 62200f4
committed
specs-go: don't use fmt.Sprintf to init Version
Version is initialized during package initialization, which happens on
every start of any program importing this package (for example, runc,
which re-executes itself on every container start and exec).
Using fmt.Sprintf for that takes about 4us and 5 allocations (2920
bytes). Using strconv.Itoa and string concatenation takes almost no
time and a single 16-byte allocation.
As a bonus, the package no longer imports fmt.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>1 parent bb96cde commit 62200f4
1 file changed
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
0 commit comments