Commit 2571efd
committed
Improve the performance of runtime.Fetch for structures
The improvement comes from the use of a cache to speed up the
retrieval of struct fields. This commit also adds a new benchmark to
measure the performance gain.
goos: linux
goarch: amd64
pkg: github.com/expr-lang/expr
cpu: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
│ /tmp/old.txt │ /tmp/new.txt │
│ sec/op │ sec/op vs base │
_envStruct_noEnv-8 503.3n ± 4% 228.8n ± 3% -54.53% (p=0.000 n=10)
│ /tmp/old.txt │ /tmp/new.txt │
│ B/op │ B/op vs base │
_envStruct_noEnv-8 48.00 ± 0% 32.00 ± 0% -33.33% (p=0.000 n=10)
│ /tmp/old.txt │ /tmp/new.txt │
│ allocs/op │ allocs/op vs base │
_envStruct_noEnv-8 3.000 ± 0% 1.000 ± 0% -66.67% (p=0.000 n=10)1 parent 1c09e5e commit 2571efd
2 files changed
+49
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
269 | 293 | | |
270 | 294 | | |
271 | 295 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
13 | 21 | | |
14 | 22 | | |
15 | 23 | | |
| |||
63 | 71 | | |
64 | 72 | | |
65 | 73 | | |
66 | | - | |
67 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
68 | 85 | | |
69 | 86 | | |
70 | 87 | | |
| |||
74 | 91 | | |
75 | 92 | | |
76 | 93 | | |
77 | | - | |
78 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
79 | 100 | | |
80 | 101 | | |
81 | 102 | | |
| |||
0 commit comments