Commit ee4e077
authored
Add StringIntern for Item and Property Functions. (#9024)
Remove duplicated strings from Item and Property Function. Intern these strings to reduce memory usage.
Context
Strings used parsing Item and Property Function are duplicated many times, common offenders are "Contains", "Strings", and "true".
Changes Made
Use the Strings.WeakIntern() tool to cache the strings. Since these are common strings which are shared among projects, use the global String store instead of the project specific store.
Testing
Profiled with the Visual Studio Memory Inspector. This reduced 5-6mb of strings saved in our internal Repro of 200 projects.
Notes
There are still other places here duplicate string exists, this PR focus only on these locations.1 parent 9394ada commit ee4e077
2 files changed
+6
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3315 | 3315 | | |
3316 | 3316 | | |
3317 | 3317 | | |
3318 | | - | |
| 3318 | + | |
3319 | 3319 | | |
3320 | 3320 | | |
3321 | 3321 | | |
| |||
3373 | 3373 | | |
3374 | 3374 | | |
3375 | 3375 | | |
3376 | | - | |
| 3376 | + | |
3377 | 3377 | | |
3378 | 3378 | | |
3379 | 3379 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
| 159 | + | |
163 | 160 | | |
164 | 161 | | |
165 | 162 | | |
| |||
251 | 248 | | |
252 | 249 | | |
253 | 250 | | |
254 | | - | |
| 251 | + | |
255 | 252 | | |
256 | 253 | | |
257 | | - | |
| 254 | + | |
258 | 255 | | |
259 | 256 | | |
260 | 257 | | |
| |||
601 | 598 | | |
602 | 599 | | |
603 | 600 | | |
604 | | - | |
| 601 | + | |
605 | 602 | | |
606 | 603 | | |
607 | 604 | | |
| |||
0 commit comments