Skip to content

Reduce value type boxing in interop calls #787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 27, 2025

Conversation

lahma
Copy link
Collaborator

@lahma lahma commented Apr 27, 2025

  • special case common bool and int property access
  • use abstract class instead of interface do reduce virtual dispatch cost

When profiling NJsonSchema, found out that now after optimizations almost 10% of allocations originate from boolean value boxing (very common in code generation templates).

image

* special case common bool and int property access
* use abstract class instead of interface do reduce virtual dispatch cost
@lahma lahma force-pushed the reduce-interop-boxing branch from 89a7e90 to 8175a98 Compare April 27, 2025 15:22
@lahma lahma force-pushed the reduce-interop-boxing branch from 8175a98 to fe7c7ad Compare April 27, 2025 15:24
@sebastienros
Copy link
Owner

Did you check what I did in the other branch I mentioned last time? Similar to skip the boxing, but did it for any common type. Not the new specific classes though.

@sebastienros sebastienros merged commit 9b11031 into sebastienros:main Apr 27, 2025
1 check passed
@lahma lahma deleted the reduce-interop-boxing branch April 28, 2025 06:11
@lahma
Copy link
Collaborator Author

lahma commented Apr 28, 2025

Did you check what I did in the other branch I mentioned last time? Similar to skip the boxing, but did it for any common type. Not the new specific classes though.

No I didn't notice that one, it's quite big diff. Maybe you could bring improvements from there in smaller batches?

@sebastienros
Copy link
Owner

No, it's a big breaking change, the goal is to ship a 3.0 with it. I'll move your improvements there though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants