Skip to content

Commit f8770ab

Browse files
committed
demo impact of avoiding the first letter
1 parent 4e5260d commit f8770ab

File tree

6 files changed

+402
-403
lines changed

6 files changed

+402
-403
lines changed

packages/cursorless-engine/src/test/fixtures/hat-stats/intern.go.golden

+58-58
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,54 @@
1-
* * * * * *
1+
* * * * * *
22
// Package intern interns strings.
33
[] [-----] [----] [-----] [-----]#
44

5-
x x x
6-
* * * * * * *
5+
x x
6+
* * * * * * *
77
// Interning is best effort only.
88
[] [-------] [] [--] [----] [--]#
99

10-
v x
11-
* * * * * * *
10+
v
11+
* * * * * * *
1212
// Interned strings may be removed automatically
1313
[] [------] [-----] [-] [] [-----] [-----------]
1414

15-
w x v
16-
* * * * * * *
15+
w x x v
16+
* * * * * * *
1717
// at any time without notification.
1818
[] [] [-] [--] [-----] [----------]#
1919

20-
o x v x
21-
* * * * * * *
20+
o x x x x x
21+
* * * * * * *
2222
// All functions may be called concurrently
2323
[] [-] [-------] [-] [] [----] [----------]
2424

25-
# x x x x w
26-
* * * * * * *
25+
# x v x vw
26+
* * * * * **
2727
// with themselves and each other.
2828
[] [--] [--------] [-] [--] [---]#
2929

30-
x
31-
* *
30+
v
31+
* *
3232
package intern
3333
[-----] [----]
3434

35-
x x x
36-
* * * *
35+
v x
36+
* * * *
3737
import "sync"
3838
[----] #[--]#
3939

40-
v v v ox w #v
41-
* * * ** * * ** *
40+
x v w o x o # v
41+
* * * * * * * * * *
4242
var pool sync.Pool = sync.Pool{
4343
[-] [--] [--]#[--] # [--]#[--]#
4444

45-
x x v x v
46-
** * ** * ** *
45+
x x v x v
46+
** * ** * ** *
4747
␉New: func() interface{} {
4848
[-]# [--]## [-------]## #
4949

50-
x x x w x o x
51-
* * * ** *** *
50+
v x x x x w x
51+
* * * ** ** * *
5252
␉␉return make(map[string]string)
5353
[----] [--]#[-]#[----]#[----]#
5454

@@ -62,37 +62,37 @@ v
6262
}
6363
#
6464

65-
^ # v ^x v^
66-
* * * ** **
65+
^ o w xx w^
66+
* * * ** **
6767
// String returns s, interned.
6868
[] [----] [-----] ## [------]#
6969

70-
v vv0 x v > w
71-
* *** * * * *
70+
v vvv # v ^ w
71+
* *** * * * *
7272
func String(s string) string {
7373
[--] [----]## [----]# [----] #
7474

75-
v xx v 0 v ww>o v x~ x+ o
76-
* ** * * * **** * ** ** *
75+
x xx w 0 v ww>o v x w x 0 o
76+
* ** * * * **** * * * * * *
7777
␉m := pool.Get().(map[string]string)
7878
# ## [--]#[-]####[-]#[----]#[----]#
7979

80-
vv v vv wv v
81-
** * ** **b*
80+
wv v vv vvwv
81+
** * ** ****
8282
␉c, ok := m[s]
8383
## [] ## ####
8484

85-
w w o
86-
* * *
85+
x w o
86+
* * *
8787
␉if ok {
8888
[] [] #
8989

90-
w~ w #o#
90+
w~ o #w#
9191
** * ***
9292
␉␉pool.Put(m)
9393
[--]#[-]###
9494

95-
w w
95+
w o
9696
* *
9797
␉␉return c
9898
[----] #
@@ -102,18 +102,18 @@ func String(s string) string {
102102
␉}
103103
#
104104

105-
#w w w
106-
**g* * r
105+
owow w #
106+
**** * *
107107
␉m[s] = s
108108
#### # #
109109

110-
o + o ^^^
110+
o + # ^#^
111111
* * * ***
112112
␉pool.Put(m)
113113
[--]#[-]###
114114

115-
x
116-
* p
115+
o ^
116+
* *
117117
␉return s
118118
[----] #
119119

@@ -122,37 +122,37 @@ o
122122
}
123123
#
124124

125-
0 w v o w v w ww o
126-
* * * * * * * ** * b
125+
0 # ^ x v # w ww #
126+
* * * * * * * ** * b
127127
// Bytes returns b converted to a string, interned.
128128
[] [---] [-----] # [-------] [] # [----]# [------]#
129129

130-
o v 0# oo w 0 o #
131-
* * ** ** * * * *
130+
0 ^ 0v oo 0 0 o #
131+
* * ** ** * * * *
132132
func Bytes(b []byte) string {
133133
[--] [---]## ##[--]# [----] #
134134

135-
0 wo o # >> ~ o # # ~
136-
* ** *g * **r* * *y *1 *
135+
^ wo o ^ >> ~ o # o # > ~
136+
* ** *g * **r* * * * * * *
137137
␉m := pool.Get().(map[string]string)
138138
# ## [--]#[-]####[-]#[----]#[----]#
139139

140-
oo w o# >^ +^+^
141-
** * ** **2 ****
140+
#o o o# 0^ ~ +w+^
141+
** * ** ** * ****
142142
␉c, ok := m[string(b)]
143143
## [] ## ##[----]####
144144

145-
# # ^
146-
* * *
145+
v # ^
146+
* * *
147147
␉if ok {
148148
[] [] #
149149

150-
# # ~
150+
# > >
151151
*p * b*b
152152
␉␉pool.Put(m)
153153
[--]#[-]###
154154

155-
^ #
155+
0 ^
156156
* *
157157
␉␉return c
158158
[----] #
@@ -162,23 +162,23 @@ func Bytes(b []byte) string {
162162
␉}
163163
#
164164

165-
x #^ # 0
166-
b ** *g*g
165+
0 #^ # o
166+
* ** *g*g
167167
␉s := string(b)
168168
# ## [----]###
169169

170-
+0v0 0 w
171-
**b* * b
170+
~0>0 0 ~
171+
**** * *
172172
␉m[s] = s
173173
#### # #
174174

175-
^ ^
176-
* y * rbr
175+
^ ~ +
176+
* y * r*r
177177
␉pool.Put(m)
178178
[--]#[-]###
179179

180-
0 o
181-
* b
180+
> +
181+
* *
182182
␉return s
183183
[----] #
184184

packages/cursorless-engine/src/test/fixtures/hat-stats/intern.go.stats

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ nPenalty0:
1414
spark: 0 █ 25 50 75 100
1515

1616
nPenalty1:
17-
mean: 84%
18-
std: 1%
19-
min: 83%
17+
mean: 85%
18+
std: 0%
19+
min: 85%
2020
max: 85%
21-
spark: 0 25 50 75 █ 100
21+
spark: 0 25 50 75 █ 100
2222

2323
nPenalty2:
24-
mean: 1%
25-
std: 1%
24+
mean: 0%
25+
std: 0%
2626
min: 0%
27-
max: 2%
27+
max: 0%
2828
spark: 0 █ 25 50 75 100
2929

0 commit comments

Comments
 (0)