Skip to content

Improve TypedIndex (and similar) performance - #416

Merged
RossNordby merged 2 commits into
bepu:masterfrom
ds5678:typed-index
Aug 17, 2026
Merged

Improve TypedIndex (and similar) performance#416
RossNordby merged 2 commits into
bepu:masterfrom
ds5678:typed-index

Conversation

@ds5678

@ds5678 ds5678 commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Applying readonly to a struct prevents the compiler from generating defensive copies.

I also found some code in these structs using 64 bit signed integers instead of 32 bit unsigned integers.

See: https://devblogs.microsoft.com/premier-developer/avoiding-struct-and-readonly-reference-performance-pitfalls-with-errorprone-net/

ds5678 added 2 commits August 14, 2026 21:58
Applying `readonly` to a struct prevents the compiler from generating defensive copies.

I also found some code in these structs using 64 bit signed integers instead of 32 bit unsigned integers.
@RossNordby

Copy link
Copy Markdown
Member

looks like the compiler already handled most of it (except the 64 bit oopsy), but seems good! thanks!

@RossNordby RossNordby added performance Change primarily focused at improving performance. breaking-change The change contains a breaking change that may annoy everyone and require code updates! labels Aug 17, 2026
@RossNordby
RossNordby merged commit 16ecf9c into bepu:master Aug 17, 2026
1 check passed
@ds5678
ds5678 deleted the typed-index branch August 17, 2026 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change The change contains a breaking change that may annoy everyone and require code updates! performance Change primarily focused at improving performance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants