Dapper icon indicating copy to clipboard operation
Dapper copied to clipboard

performance: skip `ToString` with interpolated string

Open TimothyMakkison opened this issue 6 months ago • 1 comments

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

TimothyMakkison avatar Jul 06 '25 15:07 TimothyMakkison

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.

TimothyMakkison avatar Jul 06 '25 21:07 TimothyMakkison