Skip to content

performance: skip ToString with interpolated string #2175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

TimothyMakkison
Copy link

@TimothyMakkison TimothyMakkison commented Jul 6, 2025

Interpolated string skips the Guid.ToString allocation by calling ISpanFormattable.TryFormat

Copy link
Member

@mgravell mgravell left a comment

Choose a reason for hiding this comment

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

Yep, I'm very familiar with the joys of interpolated string internals (I was very recently proposing changes to /runtime in that area) - LGTM

@TimothyMakkison
Copy link
Author

TimothyMakkison commented Jul 6, 2025

Yep, I'm very familiar with the joys of interpolated string internals (I was very recently proposing changes to /runtime in that area)

I wish the compiler were smart enough to do this by default for common types. I've done this exact same change so many times 😞

OOC how much focus does Dapper place on performance? Looking through the repository I can definitely see a couple of changes to remove redundant strings ie Database.Async. IIRC there were some places where ValueListBuilder could be used, I doubt it would be a massive boost tho.

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.

2 participants