For example, for the Message.Parse method, inlining the private methods ParseField, ParseTag and ParseValue improves the latency and throughput quite dramatically:
Parsing a real-world FIX message of length 1000 with 90 fields:
Methodology
Latency
Throughput
Original
3.22 us
309,000 /s
Inlined
2.02 us
494,000 /s
Because of the drastic improvements that are possible, we should remember to revisit code on the hot path and verify whether it is worth inlining method/function calls for performance improvements...
Method inlining
in C# (see https://www.dotnetperls.com/inline-optimization and https://www.dotnetperls.com/aggressiveinlining) can drastically improve performance in respect of latency/throughput.For example, for the
Message.Parse
method, inlining the private methodsParseField
,ParseTag
andParseValue
improves the latency and throughput quite dramatically:Parsing a real-world FIX message of length 1000 with 90 fields:
Because of the drastic improvements that are possible, we should remember to revisit code on the hot path and verify whether it is worth inlining method/function calls for performance improvements...