5 ms·
As of .NET 6/7, I'm pretty sure the implementation could be refactored to be much more simple and less reliant on hacks - minimal APIs give good performance and
by neonsunset 4y ago
As of .NET 6/7, I'm pretty sure the implementation could be refactored to be much more simple and less reliant on hacks - minimal APIs give good performance and outputting raw bytes as "Hello World!"u8 seems innocent enough which many other benchmark implementations do anyway.
- piaste 4y ago> minimal APIs give good performance I thought the minimal APIs were just a bit of syntactic sugar over the same underlying architecture. Are you saying they are actually different in a more fundamental way?
- neonsunset 4y agoYou are correct, they serve as a convenience and conciseness feature. However, the way they are implemented lends itself well into ASP.NET Core’s requests handling pipeline which means that traditional controller-based pattern is actually more expensive. The fastest option when using min apis is to take HttpContext directly, which is convenient anyways when you are outputting raw bytes.