Repository navigation
C#: create the sender and receiver models on first use - #114
Open
jccarvalhosa wants to merge 1 commit into
Open
jccarvalhosa wants to merge 1 commit into
jccarvalhosa wants to merge 1 commit into
Conversation
The generated Sender, Receiver, Proxy and Client created the model of every message of the protocol in their constructors, and the Receiver and Client also built the Default value of every message. Each model is a distinct generic instantiation over the message struct, so the first Sender or Receiver of a process made the JIT compile all of them before a single message went out, whichever messages the process actually used: a protocol with a few hundred message and field models spent a noticeable part of a client's start-up there. Each model is now created the first time its message is sent or received, behind a property of the same name, so existing code reading Sender.XModel or Client.XSenderModel compiles unchanged. Once a model exists the access is a null check, with no further allocation. The received value fields are no longer initialized with Default, since every receive assigns them through Deserialize(out ...) before they are read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The generated Sender, Receiver, Proxy and Client created the model of every message of the protocol in their constructors, and the Receiver and Client also built the Default value of every message. Each model is a distinct generic instantiation over the message struct, so the first Sender or Receiver of a process made the JIT compile all of them before a single message went out, whichever messages the process actually used: a protocol with a few hundred message and field models spent a noticeable part of a client's start-up there.
Each model is now created the first time its message is sent or received, behind a property of the same name, so existing code reading Sender.XModel or Client.XSenderModel compiles unchanged. Once a model exists the access is a null check, with no further allocation. The received value fields are no longer initialized with Default, since every receive assigns them through Deserialize(out ...) before they are read.