-
Notifications
You must be signed in to change notification settings - Fork 824
Closed
Labels
Area-Compiler-OptimizationThe F# optimizer, release code gen etc.The F# optimizer, release code gen etc.Feature Improvement
Milestone
Description
System.numerics.vectors exposes a SIMD enhanced Vector classes. Using VS2015 Update 1, latest versions of .NET framework and F# and System.numerics.vectors the performance of System.Numerics is worse than not using it at all, for instance:
let sumVectorLoop =
let mutable total = Vector<int>.Zero
for i in 0 .. COUNT/8-1 do
total <- total + vecArray.[i]
total
Is slower than the same operation on an array of integers:
let sumsLoop =
let mutable total = 0;
for i in 0 .. COUNT - 1 do
total <- total + numsArray.[i]
total
I have confirmed that Vector.isHardwareAccelerated
reports as true. I have confirmed that equivalent code in C# runs ~2x faster for the Vector approach. Interestingly, using Array.reduce on the vector array is faster than the imperative loop, which is the opposite of working with an array of ints, suggesting something may be amiss:
let sumVectorReduce =
Array.reduce (fun a e -> a + e) vecArray
marklam
Metadata
Metadata
Assignees
Labels
Area-Compiler-OptimizationThe F# optimizer, release code gen etc.The F# optimizer, release code gen etc.Feature Improvement
Type
Projects
Status
Done