Use single argument overload for [start..] of string or (ReadOnly)Span#74643
Use single argument overload for [start..] of string or (ReadOnly)Span#74643tats-u wants to merge 15 commits intodotnet:mainfrom
[start..] of string or (ReadOnly)Span#74643Conversation
2fe693f to
7324eeb
Compare
|
rebased to e8bae2f, the latest merge commit where the CI succeeds. |
|
All perf changes need to be accompanied by benchmarks showing their impact, just "produces smaller il" is not enough. The linked issue has benchmarks from 4 years ago; that's both very out of date, and the benchmarking code has a lot of unrelated operations in it. |
|
https://github.com/tats-u/SubstringSliceBench For
For
|
|
I'll have to compare the internal code of |
|
@stephentoub, a penny for your thoughts on this optimization? |
I've not looked at the PR, but from my perspective addressing it would be nice to have: |
I agree with you. |
|
Should I optimize for |
|
I'ma fan of this sort of optimization. It means that people can use the more modern/idiomatic patterns, without worry about a perf cliff. |
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IndexerAccess.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IndexerAccess.cs
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IndexerAccess.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IndexerAccess.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IndexerAccess.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Fred Silberberg <frsilb@microsoft.com>
|
Update: eventually didn't occur |
|
roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/SpanStackSafetyTests.cs Lines 1725 to 1727 in cad8698 In the current change, this diagnostic doesn't seem to come up. |
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IndexerAccess.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IndexerAccess.cs
Outdated
Show resolved
Hide resolved
|
Also, it looks like there are test failures. |
Co-authored-by: Fred Silberberg <frsilb@microsoft.com>
|
I knew that but the CI insists that I hadn't fixed the places where I fixed in e2b3f40. |
I saw the console output, but the ILs in Expected are those before that commit. |
|
All existing unit tests now pass, but I couldn't understand what the following in Rebuild tests means: |
|
Hi @tats-u, if you have some time, please try merging the latest main in, and we will try and help with investigating the CI failures. |
|
Related: dotnet/runtime#122042 (while we want to improve the codegen in JIT, I think it'd be nice for Roslyn to emit |
|
rebased and opened #81485 |
|
I cannot spare time for this pull request for the time being, so I will close it for now. Is it better just to make it draft again? @kasperk81 Merge instead of rebase is more recommended in this repository. |
isn't the rule don't rebase: when review has started? anyways, your branch was 1700+ commits behind. i rebased to a single commit, cherry picked it on main and resolved conflicts |
|
Over a year ago, but I got reviews twice. |
|
If you want to take over my work, I would like you to fix "(Don't emit extra stloc. n and ldloc. n )" in TODO. I remember it a little now. |
i was talking about the new pr. we can rebase and force push as we please before the maintainers have started the review.
|
Uses the single argument overloads of
string.Substringand(ReadOnly)Span.Sliceinstead of 2 arguments ones for lowering[start..].This change shortens ILs and x64 assemblies.
Fixes #47629
TODO:
MemorySlicemethodFailsILVerify.WithILVerifyMessagestloc.ldloc.