Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Scope for improving Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame.TakeStartLine(SocketInput) #1213

@sivarv

Description

@sivarv

TakeStartLine() is one of the hot methods in TechEmPower PlainText and JSON benchmarks.
Jitted code of this method could be improved in the following way:

This method calls the following methods by passing structs by value

MemoryPoolIteratorExtensions:GetAsciiString(struct,struct)
MemoryPoolIteratorExtensions:GetKnownMethod(struct,byref)
MemoryPoolIteratorExtensions:GetKnownVersion(struct,byref)
MemoryPoolIteratorExtensions:GetUtf8String(struct,struct)

The struct param in question is MemoryPoolIterator, which is a struct with two fields: a ref and an int. On Amd64 a local copy of struct param is made and a reference to local copy is passed by reference. Since there are many such calls, at each call site struct params needs to be copied to local. This struct passing overhead could be avoided if caller TakeStartLine() passes struct params by reference.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions