bubbles icon indicating copy to clipboard operation
bubbles copied to clipboard

perf(key): optimize `Matches`

Open knz opened this issue 3 years ago • 5 comments
trafficstars

Fixes #262.

name                old time/op    new time/op    delta
Matches/success-32    66.9ns ± 1%    15.7ns ± 0%   -76.47%  (p=0.016 n=5+4)
Matches/fail-32       27.9ns ± 0%    12.4ns ± 2%   -55.70%  (p=0.016 n=4+5)

name                old alloc/op   new alloc/op   delta
Matches/success-32     5.00B ± 0%     0.00B       -100.00%  (p=0.008 n=5+5)
Matches/fail-32        0.00B          0.00B           ~     (all equal)

name                old allocs/op  new allocs/op  delta
Matches/success-32      1.00 ± 0%      0.00       -100.00%  (p=0.008 n=5+5)
Matches/fail-32         0.00           0.00           ~     (all equal)

cc @meowgorithm @muesli

knz avatar Oct 02 '22 18:10 knz

NB: I could imagine the map from string to tea.Key being defined in the bubbletea package directly. If you prefer that, let me know.

knz avatar Oct 02 '22 18:10 knz

NB: I could imagine the map from string to tea.Key being defined in the bubbletea package directly. If you prefer that, let me know.

I think that makes sense and is probably nicer next to the other tea.Key code.

muesli avatar Oct 05 '22 02:10 muesli

Whoa! This is awesome @knz, solid optimization!

maaslalani avatar Oct 06 '22 19:10 maaslalani

I think that makes sense and is probably nicer next to the other tea.Key code.

Ok see https://github.com/charmbracelet/bubbletea/pull/491

Then to merge this PR I'll need a release number for the go.mod update.

knz avatar Oct 06 '22 20:10 knz

@muesli Is this good to merge?

maaslalani avatar Feb 28 '24 16:02 maaslalani