go-mtree icon indicating copy to clipboard operation
go-mtree copied to clipboard

govis: various modernisations and optimisations

Open cyphar opened this issue 3 months ago • 0 comments

Included in this patchset is a ~6x performance improvement to Vis and a ~3x performance improvement to Unvis for plain strings that do not require any escaping (strings that require escaping still have a decent performance boost too).

goos: linux
goarch: amd64
pkg: github.com/vbatts/go-mtree/pkg/govis
cpu: AMD Ryzen 7 7840U w/ Radeon  780M Graphics
                │    before    │                after                │
                │    sec/op    │   sec/op     vs base                │
Vis/NoChange-16   2372.5n ± 2%   379.1n ± 1%  -84.02% (p=0.000 n=10)
Vis/Binary-16      2.104µ ± 8%   1.319µ ± 8%  -37.35% (p=0.000 n=10)
Vis/ASCII-16      2070.0n ± 1%   737.3n ± 0%  -64.38% (p=0.000 n=10)
Vis/German-16      3.380µ ± 1%   1.181µ ± 2%  -65.04% (p=0.000 n=10)
Vis/Russian-16    10.927µ ± 2%   5.293µ ± 2%  -51.56% (p=0.000 n=10)
Vis/Japanese-16    7.489µ ± 1%   3.990µ ± 0%  -46.72% (p=0.000 n=10)
geomean            3.767µ        1.447µ       -61.58%
goos: linux
goarch: amd64
pkg: github.com/vbatts/go-mtree/pkg/govis
cpu: AMD Ryzen 7 7840U w/ Radeon  780M Graphics
                  │    before    │                after                │
                  │    sec/op    │   sec/op     vs base                │
Unvis/NoChange-16   1501.0n ± 0%   497.7n ± 1%  -66.84% (p=0.000 n=10)
Unvis/Binary-16     1317.5n ± 3%   934.9n ± 9%  -29.04% (p=0.000 n=10)
Unvis/ASCII-16      1325.5n ± 1%   616.8n ± 1%  -53.47% (p=0.000 n=10)
Unvis/German-16     1884.5n ± 1%   986.9n ± 2%  -47.63% (p=0.000 n=10)
Unvis/Russian-16     4.636µ ± 1%   3.796µ ± 1%  -18.11% (p=0.000 n=10)
Unvis/Japanese-16    3.453µ ± 1%   2.867µ ± 1%  -16.99% (p=0.000 n=10)
geomean              2.072µ        1.206µ       -41.77%

Signed-off-by: Aleksa Sarai [email protected]

cyphar avatar Sep 21 '25 17:09 cyphar