Commit Graph

3 Commits (a0d6bbe1076e60c4cfb1c8f7166532f421a4eb49)

Author SHA1 Message Date
Daniel Martí a0d6bbe107
store name pairs for _realName as a slice of pairs
Iterating over a map is much more expensive than iterating over a slice,
given how it needs to work out which keys are present in each bucket
and then randomize the order in which to navigate the keys.
None of this work needs to happen when iterating over a slice.

A map would be nice if we were to actually do map lookups, but we don't.

                  │     old     │                new                 │
                  │   sec/op    │   sec/op     vs base               │
    AbiRealName-8   707.1µ ± 1%   196.7µ ± 1%  -72.17% (p=0.001 n=7)

                  │     old      │                  new                  │
                  │     B/s      │      B/s       vs base                │
    AbiRealName-8   517.6Ki ± 2%   1816.4Ki ± 1%  +250.94% (p=0.001 n=7)

                  │     old      │                new                 │
                  │     B/op     │     B/op      vs base              │
    AbiRealName-8   5.362Ki ± 0%   5.359Ki ± 0%  -0.05% (p=0.001 n=7)

                  │    old     │              new              │
                  │ allocs/op  │ allocs/op   vs base           │
    AbiRealName-8   19.00 ± 0%   19.00 ± 0%  ~ (p=1.000 n=7) ¹
4 months ago
Daniel Martí 0320476fa7
optimize _realName a bit via shortcuts
│     old      │                new                 │
                  │    sec/op    │   sec/op     vs base               │
    AbiRealName-8   1025.9µ ± 6%   707.1µ ± 1%  -31.08% (p=0.001 n=7)

                  │     old      │                 new                 │
                  │     B/s      │     B/s       vs base               │
    AbiRealName-8   351.6Ki ± 6%   517.6Ki ± 2%  +47.22% (p=0.001 n=7)

                  │     old      │              new              │
                  │     B/op     │     B/op      vs base         │
    AbiRealName-8   5.363Ki ± 0%   5.362Ki ± 0%  ~ (p=0.178 n=7)

                  │    old     │              new              │
                  │ allocs/op  │ allocs/op   vs base           │
    AbiRealName-8   19.00 ± 0%   19.00 ± 0%  ~ (p=1.000 n=7) ¹
4 months ago
Daniel Martí c6236ca953
split code to inject into internal/abi into a separate file
This way we can edit it as regular Go code, with the help of an LSP,
and we can also test and benchmark it.
4 months ago