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

Reduce # of allocated objects #1081

Merged
merged 8 commits into from
Jan 21, 2022
Merged

Conversation

manodasanW
Copy link
Member

@manodasanW manodasanW commented Jan 20, 2022

  • Replace delegates with function pointers where possible
  • Remove unnecessary creation of IMarshal object to optimize CreateObject scenario
  • Cache subscribe / unsubscribe actions to avoid creating them each time
  • Fix some warnings

Before

Method Mean Error StdDev Gen 0 Gen 1 Gen 2 Allocated
AddAndInvokeMultipleIntEventsToSameEventSource 19,042.9 ns 365.40 ns 406.14 ns 0.4883 0.2136 0.0610 2,649 B
CreateAndIterateList 10,524.33 ns 188.582 ns 251.752 ns 0.7477 0.3662 - 3,144 B

After

Method Mean Error StdDev Gen 0 Gen 1 Gen 2 Allocated
AddAndInvokeMultipleIntEventsToSameEventSource 18,977.4 ns 363.47 ns 432.69 ns 0.4272 0.1526 0.0305 2,442 B
CreateAndIterateList 9,119.60 ns 174.545 ns 171.427 ns 0.6409 0.3204 - 2,697 B

@manodasanW manodasanW merged commit 0041d18 into master Jan 21, 2022
@manodasanW manodasanW deleted the manodasanw/imarshalOptimization branch January 21, 2022 20: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