Commit 83b8bbd
committed
Add a small LRU cache in front of calls to
We are almost always normalizing the same strings over and over again. Think
about when iterating over mappings: we are reconstructing each mapping's source,
but the mappings are in sorted order, and so will likely have the same source
every time.
This makes us take .09x the time that we used to take on the
"iterate.already.parsed" benchmark!!
Without the LRU cache:
Samples Total (ms) Mean (ms) Standard Deviation (ms)
50 257604.64 5152.09 221.19
With the new LRU cache:
Samples Total (ms) Mean (ms) Standard Deviation (ms)
50 23301.74 466.03 56.14normalize
1 parent 57d2dcb commit 83b8bbd
2 files changed
+78
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
148 | 185 | | |
149 | 186 | | |
150 | 187 | | |
| |||
156 | 193 | | |
157 | 194 | | |
158 | 195 | | |
159 | | - | |
| 196 | + | |
160 | 197 | | |
161 | 198 | | |
162 | 199 | | |
| |||
216 | 253 | | |
217 | 254 | | |
218 | 255 | | |
219 | | - | |
| 256 | + | |
220 | 257 | | |
221 | 258 | | |
222 | 259 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
69 | 106 | | |
70 | 107 | | |
71 | 108 | | |
| |||
77 | 114 | | |
78 | 115 | | |
79 | 116 | | |
80 | | - | |
| 117 | + | |
81 | 118 | | |
82 | 119 | | |
83 | 120 | | |
| |||
137 | 174 | | |
138 | 175 | | |
139 | 176 | | |
140 | | - | |
| 177 | + | |
141 | 178 | | |
142 | 179 | | |
143 | 180 | | |
| |||
0 commit comments