Commit 452cc1e
Cache J2N numeric type lookups per-Compilation
Address Copilot review: GetJ2NNumericTypes was calling
GetTypeByMetadataName for all 7 J2N numeric types on every numeric
invocation/concat/interpolation node visited. The result is identical
for the lifetime of a Compilation, so cache it in a
ConditionalWeakTable keyed by Compilation.
Also short-circuits IsJ2NNumericType: BCL primitives never live under
J2N.Numerics, so checking the containing namespace's display string up
front avoids the symbol-equality loop entirely on the hottest path.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 2a4326a commit 452cc1e
1 file changed
Lines changed: 23 additions & 3 deletions
Lines changed: 23 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
85 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
86 | 97 | | |
| 98 | + | |
87 | 99 | | |
88 | 100 | | |
89 | 101 | | |
90 | | - | |
| 102 | + | |
91 | 103 | | |
| 104 | + | |
92 | 105 | | |
93 | 106 | | |
94 | 107 | | |
95 | 108 | | |
96 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
97 | 117 | | |
98 | 118 | | |
99 | | - | |
| 119 | + | |
100 | 120 | | |
101 | 121 | | |
102 | 122 | | |
| |||
0 commit comments