-
Notifications
You must be signed in to change notification settings - Fork 539
[C#] Use throw helpers for generated code #588
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
Comments
Any comment? |
Seems like a good idea to me. We can fit more "useful" instructions in the cache. |
@ZachBray Yes, another side-effect of this is that this potentially makes some/all getters inlineable by the JIT by default without needing to force inlining with things such as |
This sounds good. I'll be interested to see what performance difference it
might make to the car example.
Bill.
…On Thu, Oct 11, 2018 at 8:06 PM damageboy ***@***.***> wrote:
@ZachBray <https://github.com/ZachBray> Yes, another side-effect of this
is that this potentially makes some/all getters inlineable by the JIT by
default without needing to force inlining with things such as
AggressiveInlining.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#588 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFI1pAFB1tLPP1D7TeoilmWjWAPjWhNFks5ujxg1gaJpZM4XA9f_>
.
|
damageboy
added a commit
to damageboy/simple-binary-encoding
that referenced
this issue
Jul 16, 2019
- Add a ThrowHelper utility class that provides non-returning methods for throwing exceptions, this in turn helps to reduce the code size, there-by increasing the chances of inlining simple (getter/setter) methods, which has cascading CQ improvments in its own. (See: dotnet/coreclr#6103) - Convert checks in the form of `(x < 0 || x > max)` to `(uint) x > max` to further reduce code-size and increase inlining chances - Update MSTest package deps - Drop netfx.props (which I introduces in a previous PR to support building on linux) and replace with the now standard/canonical way of referencing NetFX BCL on all platforms with a <PackageReference> - closes aeron-io#588
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently the generated code in the C# generated Getters/Setters for fixed array types and a few other cases calls a rather lengthy set of operations for the uncommon path of throwing an exception in case the provided parameters were not constructed properly.
While this is of course important, for the general case, this is also somewhat inefficient in its current form as the code to generate the exception is being repeated many times, leading to generated code bloat, esp. when it comes down to the JITed code size.
I'm copy-pasting this from CoreCLR's own
ThrowHelper.cs
:This is even more severe in the generated SBE code, as due to string formatting each such block is 27 bytes long rather than the 21 mentioned in CoreCLR for their "pattern".
I would like to work on adding a minimal ThrowHelper.cs to
SBE.dll
and do the work of calling the throw helpers rather than generated the current exception throwing code, Any thoughts or comments about this?The text was updated successfully, but these errors were encountered: