-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Use Span<Char>.Fill in String(Char, Int32) constructor #57993
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @dotnet/area-system-runtime Issue DetailsThis would most likely be a significant performance improvement, especially with the vectorized span fill introduced in #51365.
|
@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). |
@GrabYourPitchforks I can look into it. Could you assign this to me? |
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: BenchmarkDotNet=v0.13.1, OS=Windows 10.0.22000
Intel Core i7-7700K CPU 4.20GHz (Kaby Lake), 1 CPU, 8 logical and 4 physical cores
.NET SDK=7.0.100-alpha.1.21467.19
[Host] : .NET 5.0.10 (5.0.1021.41214), X64 RyuJIT
Job-KJFVRU : .NET 7.0.0 (42.42.42.42424), X64 RyuJIT
Job-MZHKWO : .NET 7.0.0 (42.42.42.42424), X64 RyuJIT
IterationCount=3 LaunchCount=1 WarmupCount=3
|
@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 |
I've been playing around finding conditions where |
My benchmark: https://github.com/ahydrax/string-ctor-span-fill I would be thankful for any comments on that |
Edit: Fixed by #60269 |
@adamsitnik Did you mean to include a different link in your message above? |
@GrabYourPitchforks Yes, I meant #60269. Apologies for the confusion |
This would most likely be a significant performance improvement, especially with the vectorized span fill introduced in #51365.
The text was updated successfully, but these errors were encountered: