This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Improved performance of System.Reflection.Emit API#23833
Merged
jkotas merged 15 commits intodotnet:masterfrom Apr 15, 2019
Merged
Improved performance of System.Reflection.Emit API#23833jkotas merged 15 commits intodotnet:masterfrom
jkotas merged 15 commits intodotnet:masterfrom
Conversation
hughbe
reviewed
Apr 9, 2019
Checked again, UpdateStackSize(OpCode, int) seems to inline afterall, removed manual inline
davidfowl
reviewed
Apr 9, 2019
jkotas
reviewed
Apr 10, 2019
jkotas
reviewed
Apr 10, 2019
jkotas
reviewed
Apr 10, 2019
gfoidl
reviewed
Apr 11, 2019
Co-Authored-By: bbartels <bartels.benjamin@tutanota.de>
jkotas
reviewed
Apr 11, 2019
jkotas
reviewed
Apr 12, 2019
This was referenced Apr 17, 2019
picenka21
pushed a commit
to picenka21/runtime
that referenced
this pull request
Feb 18, 2022
) * Improved performance of System.Reflection.Emit API * Moved heap allocation to stack * Eliminating conditional branch by casting sbyte to byte * Reduced heap allocation of ScopeTree * Removed redundant `unsafe` from function signature Commit migrated from dotnet/coreclr@77a5f9c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Performance Improvements to System.Reflection.Emit.ILGenerator
When researching how dynamically emitting IL works in the CoreClr I stumbled upon a couple blocks of code that looked like they could be changed to improve performance.
This investigation led me to make significant performance improvements to the ILGenerator class.
Below is an image of the benchmarks i ran on a couple of publicly facing routines of the ILGenerator.
ILGenerator.Emit(OpCode, long)ILGenerator.Emit(OpCode)ILGenerator.Emit(OpCode, double)ILGenerator.Emit(OpCode, int)ILGenerator.Emit(OpCode, byte)ILGenerator.Emit(OpCode, float)Above table as Image of BenchmarkDotNet output (Outdated)
As you can see, a nearly 2x improvement across the board!
These improvements are not just limited to the routines in the benchmarks. Most, if not all ILGenerator.Emit routines should see some sort of improvement in performance.