Fix string.Split regression#130438
Conversation
|
Nevermind, this won't fix it - misread the platform - will re-open when I fix the code. |
|
Tagging subscribers to this area: @dotnet/area-system-runtime |
This comment was marked as outdated.
This comment was marked as outdated.
|
@EgorBot -amd -arm -intel using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);
public class Bench
{
[Benchmark]
[Arguments("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z", new char[] { ' ' }, StringSplitOptions.None)]
[Arguments("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z", new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)]
[Arguments("ABCDEFGHIJKLMNOPQRSTUVWXYZ", new char[]{' '}, StringSplitOptions.None)]
[Arguments("ABCDEFGHIJKLMNOPQRSTUVWXYZ", new char[]{' '}, StringSplitOptions.RemoveEmptyEntries)]
public string[] Split(string s, char[] arr, StringSplitOptions options)
=> s.Split(arr, options);
} |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
|
@MihuBot -arm |
|
@EgorBot -ubuntu24_azure_cobalt100 using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);
public class Bench
{
[Benchmark]
[Arguments("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z", new char[] { ' ' }, StringSplitOptions.None)]
[Arguments("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z", new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)]
[Arguments("ABCDEFGHIJKLMNOPQRSTUVWXYZ", new char[]{' '}, StringSplitOptions.None)]
[Arguments("ABCDEFGHIJKLMNOPQRSTUVWXYZ", new char[]{' '}, StringSplitOptions.RemoveEmptyEntries)]
public string[] Split(string s, char[] arr, StringSplitOptions options)
=> s.Split(arr, options);
} |
This comment was marked as outdated.
This comment was marked as outdated.
| { | ||
| Vector128<ushort> vector = Vector128.Create(sourceSpanUInt16.Slice(sourceSpanUInt16.Length - Vector128<ushort>.Count)); | ||
| Debug.Assert(sourceSpanUInt16.Length >= Vector128<ushort>.Count); | ||
| Vector128<ushort> vector = Vector128.LoadUnsafe(in MemoryMarshal.GetReference(sourceSpanUInt16), (uint)(sourceSpanUInt16.Length - Vector128<ushort>.Count)); |
There was a problem hiding this comment.
please don't replace safe code with unsafe
There was a problem hiding this comment.
It was unsafe before the PR that introduced the regression. Part of the regression is likely the bounds check that exists here now.
There was a problem hiding this comment.
That PR removed a lot more unsafe than just this one spot, and we only need to add this one spot back to get no bounds checks - surely that is fine?
|
@EgorBot -ubuntu24_azure_cobalt100 using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);
public class Bench
{
[Benchmark]
[Arguments("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z", new char[] { ' ' }, StringSplitOptions.None)]
[Arguments("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z", new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)]
[Arguments("ABCDEFGHIJKLMNOPQRSTUVWXYZ", new char[]{' '}, StringSplitOptions.None)]
[Arguments("ABCDEFGHIJKLMNOPQRSTUVWXYZ", new char[]{' '}, StringSplitOptions.RemoveEmptyEntries)]
public string[] Split(string s, char[] arr, StringSplitOptions options)
=> s.Split(arr, options);
} |
Fixes #130418 (probably).
/cc @tannergooding