Skip to content
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

Improvements to type marshaling #1096

Merged
merged 5 commits into from
Feb 3, 2022
Merged

Improvements to type marshaling #1096

merged 5 commits into from
Feb 3, 2022

Conversation

manodasanW
Copy link
Member

@manodasanW manodasanW commented Feb 1, 2022

  • Added benchmarks for type marshaling
  • Added a cache for type name generation and made use of an existing cache for the reverse lookup
  • Given the Type struct has a single field that makes it non blittable which is a string, made it a ref struct and made use of the MarshalString pinnable changes to pin the string when the ref struct for this is pinned allowing for us not need to use GC handles to do the same.
  • Fixed Marshaler to special case type as there were multiple functions with the same name now which made those lookups fail.

Master

Method Mean Error StdDev Gen 0 Allocated
GetWinRTType 1,237.2 ns 8.85 ns 7.39 ns 0.0572 240 B
SetWinRTType 531.9 ns 2.68 ns 2.51 ns 0.0935 392 B
SetPrimitiveType 310.9 ns 2.41 ns 1.88 ns 0.0401 168 B
SetNonWinRTType 377.4 ns 3.57 ns 2.79 ns 0.0572 240 B
GetExistingWinRTType 1,221.3 ns 8.08 ns 7.56 ns 0.0572 240 B

PR

Method Mean Error StdDev Gen 0 Allocated
GetWinRTType 93.29 ns 1.552 ns 1.451 ns 0.0286 120 B
SetWinRTType 156.65 ns 1.852 ns 1.641 ns - -
SetPrimitiveType 129.65 ns 2.387 ns 2.233 ns - -
SetNonWinRTType 158.73 ns 3.163 ns 4.435 ns - -
GetExistingWinRTType 94.83 ns 1.730 ns 1.533 ns 0.0286 120 B

.NET core 3.1 (previous built-in support)

Method Mean Error StdDev Gen 0 Allocated
GetWinRTType 3,829.2 ns 16.27 ns 12.70 ns 0.0229 120 B
SetWinRTType 869.7 ns 7.67 ns 5.99 ns 0.0286 120 B
SetPrimitiveType 320.0 ns 2.57 ns 2.28 ns 0.0076 32 B
SetNonWinRTType 226.6 ns 0.84 ns 0.74 ns 0.0496 208 B
GetExistingWinRTType 3,858.8 ns 30.49 ns 23.80 ns 0.0229 120 B

@manodasanW manodasanW merged commit 091f44d into master Feb 3, 2022
@manodasanW manodasanW deleted the manodasanw/xamltypes branch February 3, 2022 22:36
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.

2 participants