You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use Span<Char>.Fill in String(Char, Int32) constructor #57993
@jfd16 Thanks for the suggestion! I've marked it up for grabs so that anybody can tackle it if they're interested. Or feel free to submit a PR if you're feeling up to it.
For whoever submits a PR: please also submit benchmarks demonstrating that this is a perf win for common use cases. Maybe try lengths of 1, 2, 5, and 10 as typical use cases (to mimic code which emits padding); or 4, 8, 12, and 16 (to mimic code which emits spaces as a tab char replacement).
@SteveDunn if the implementation for the "PR" case is the code in your PR, I think there's some improvements we can do to make it perform much better (and possibly faster than main)
Activity
GrabYourPitchforks commentedon Aug 24, 2021
@jfd16 Thanks for the suggestion! I've marked it up for grabs so that anybody can tackle it if they're interested. Or feel free to submit a PR if you're feeling up to it.
For whoever submits a PR: please also submit benchmarks demonstrating that this is a perf win for common use cases. Maybe try lengths of 1, 2, 5, and 10 as typical use cases (to mimic code which emits padding); or 4, 8, 12, and 16 (to mimic code which emits spaces as a tab char replacement).
ahydrax commentedon Aug 24, 2021
@GrabYourPitchforks I can look into it. Could you assign this to me?
SteveDunn commentedon Oct 11, 2021
I was curious about this one, so I did the change and ran the benchmarks. The results were surprising though; it was slower!
Here's the results:
jkoritzinsky commentedon Oct 11, 2021
@SteveDunn if the implementation for the "PR" case is the code in your PR, I think there's some improvements we can do to make it perform much better (and possibly faster than
main)ahydrax commentedon Oct 12, 2021
I've been playing around finding conditions where
SpanHelpers.Fillcould perform better than current implementation. It looks like adding nestedifon string length adds a performance regression.I stucked with this:
https://github.com/ahydrax/runtime/blob/string-ctor-span-fill/src/libraries/System.Private.CoreLib/src/System/String.cs#L329
ahydrax commentedon Oct 12, 2021
My benchmark: https://github.com/ahydrax/string-ctor-span-fill
I would be thankful for any comments on that
adamsitnik commentedon Nov 15, 2021
Edit: Fixed by #60269
GrabYourPitchforks commentedon Nov 15, 2021
@adamsitnik Did you mean to include a different link in your message above?
adamsitnik commentedon Nov 16, 2021
@GrabYourPitchforks Yes, I meant #60269. Apologies for the confusion