Commit 2f18f40
committed
refactor(core): change GetGeneratedNamespace to NoInlining for error paths
**Issue:**
GetGeneratedNamespace() was marked with AggressiveInlining but is only
called in exception/error paths (when serializers are not registered).
**Problem:**
- Method allocates a StringBuilder and performs string manipulation
- Inlining this into every error-throwing call site bloats code size
- Error paths should be optimized for smaller code, not speed
- Misleading to mark error-path helpers as AggressiveInlining
**Solution:**
Changed `MethodImpl(MethodImplOptions.AggressiveInlining)` to
`MethodImpl(MethodImplOptions.NoInlining)` with clarifying comment.
**Benefits:**
- Smaller code size at call sites (10 call sites across NinoSerializer/NinoDeserializer)
- Clearer intent - this is an error path helper
- Consistent with other error path methods (e.g., ThrowInvalidCast in NinoDeserializer.cs:302)
- No performance impact (only called when exceptions are thrown)
**Locations using this method (all error paths):**
- NinoSerializer.cs: 154, 234, 268, 298
- NinoDeserializer.cs: 102, 148, 361, 384, 432, 455
This is a code quality improvement with no runtime performance impact
in the success case.1 parent eb4a801 commit 2f18f40
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | | - | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
0 commit comments