Skip to content

Conversation

@verdie-g
Copy link
Contributor

Small allocation that can be avoided with a stackalloc. This optimization gets burried by the deserialization of large response object. Though, if the response is small, then it matters.

I ran the benchmark code from #210 but replacing the response with an empty object.

_reader.Find<Empty>(IPAddress.Loopback);
Method Mean Error StdDev Gen0 Allocated
Before 235.4 ns 0.68 ns 0.63 ns 0.0038 64 B
After 232.8 ns 0.24 ns 0.19 ns 0.0019 32 B

Copy link
Member

@oschwald oschwald left a comment

Choose a reason for hiding this comment

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

👍

@oschwald oschwald merged commit 5111c6f into maxmind:main Apr 27, 2025
6 checks passed
oschwald added a commit that referenced this pull request May 5, 2025
@oschwald oschwald mentioned this pull request May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants