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
[Performance][Optimization] Method inline question #1807
Comments
I don't know why the methods that are attributed were attributed. Inlining already happens by the JIT automatically in cases where it is obvious to the JIT that it would provide a useful improvement. We should only add attributes where the JIT isn't already inlining it yet we've measured perf and found it to make it faster to add the attribute. |
The first challenge - how to measure accurately. However, as you've mentioned, runtime to pick how/which calls to be inlined: In case of .NET 7 the Since we are effectively trying to measure the impact of 'extra' work on top of |
Dear gents, I'm trying to squeeze every ns in de/serialization process - we are operating on 100-GBs scale.
My attention was caught on how primitives are being read/inflated, saying
MessagePackReader.Integers.cs
The op (internally) is to read bytes from span (aka
SequenceReader
) & increment position.While it (
MessagePackReader
) is beef-ed with multiple method calls:ReadInt32
ThrowInsufficientBufferUnless
TryReadBigEndian
TryRead
Keeping in mind absolute cost of method call being
cheap/non-negative
there could be a vision the flow is fine.However, if we scale/compare to logical operation reader has to do = read from array in memory VS ((push a few args into reg + call method)*3) = costly.
A few methods are marked as subject for inline
MethodImpl(MethodImplOptions.AggressiveInlining)]
.It seem like a good idea to decorate more methods with
inline
option on the surface (considering they operate on same args).The question is - were there any specific reasons why only a few inlined, or it is just codebase lifetime development (as-is)?
Cheers,
Nik
The text was updated successfully, but these errors were encountered: