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
Array slicing should be delegated to the BCL #18644
I think this would be a fairly straightforward change for arrays.
Array
Would just need to modify the body of the sub array intrinsic function with a call to System.Array.Copy. This would take advantage of faster contiguous memory copying operations in the runtime.
Activity
albert-du commentedon Jul 21, 2025
I think this would be a fairly straightforward change for arrays.
Array
Would just need to modify the body of the sub array intrinsic function with a call to
System.Array.Copy. This would take advantage of faster contiguous memory copying operations in the runtime.fsharp/src/FSharp.Core/prim-types.fs
Lines 782 to 788 in 4afdc9f
Built in F# slicing doesn't produce exceptions so behavior should be identical and this wouldn't affect the api surface, only codegen.
List
I don't see a way to improve the existing slice implementation. Unlike for arrays, the BCL doesn't provide a faster way to slice a linked list.
String
Already uses
System.String.Substringwhich has been previously optimized.fsharp/src/FSharp.Core/prim-types.fs
Lines 6683 to 6687 in 4afdc9f
If this seems like a solid direction I can put together a pr to improve array slicing
T-Gro commentedon Jul 21, 2025
Yes, focusing on array slicing and making it to use
Array.Copyis a good proposal 👍 !