Skip to content

Conversation

SergeiPavlov
Copy link
Collaborator

@SergeiPavlov SergeiPavlov commented Feb 11, 2025

There are 150K instances of DirectionCollection<ColNum> Order in RAM.

And often they are "default" empty

@SergeiPavlov SergeiPavlov changed the title Optimize RecordSetHeader.Order - use station empty intsance when there is no order Optimize RecordSetHeader.Order - use static empty instance when there is no order Feb 11, 2025
Copy link

@botinko botinko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

}
}

static RecordSetHeader()
Copy link

@snaumenko-st snaumenko-st Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to get rid of this static .ctor and create an empty locked object instantly?
static .ctor has more performance penalties than initializer.

Copy link
Collaborator Author

@SergeiPavlov SergeiPavlov Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is one-time per process penalty, right?
DO has plenty of static constructors.

Of course we can add yet one DirectionCollection constructor just for this purpose

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't remember exactly where I read it. It's not a major problem, I believe, but initializers need less checks on type load.
I'll try to figure out more info on this someday :)

@SergeiPavlov SergeiPavlov merged commit 2fe468a into master-servicetitan Feb 12, 2025
4 checks passed
@SergeiPavlov SergeiPavlov deleted the RecordSetHeaderOrder branch February 12, 2025 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants