beardgame / utilities

General C# (game) utilities library, containing a variety of useful types and algorithms
MIT License
28 stars 14 forks source link

Investigate System.Numerics and SIMD capable types #146

Open paulcscharf opened 5 years ago

paulcscharf commented 5 years ago

Since we use many of our own types, we might be able to use vector and matrix types from System.Numerics instead of OpenTK types which may result in significant speedups with calculations.

We should look into this!

tomrijnbeek commented 5 years ago

I assume we would be using this as underlying types. Would we still support conversion to OpenTK natively in our library? Alternatively if we can cut out the actual dependencies on OpenTK, we could always consider having the conversions to OpenTK types as extension methods in Bearded.Utilities.OpenTK, making the OpenTK dependency completely optional.

tomrijnbeek commented 5 years ago

That being said, I am not so sure whether it will be faster than OpenTK types. I've noticed they're really focusing on performance of operations of things like Vector multiplication in that library, so the only way System.Numerics would be faster is if they do some fancy stuff, which I doubt.

paulcscharf commented 5 years ago

They do fancy stuff, yes, they compile to SIMD operations when available. Maybe OpenTK has doing that too, or gonna do at some point, but if so I'm not aware.

tomrijnbeek commented 5 years ago

https://github.com/jackmott/LinqFaster

This library seems to have some optimisations for not just Linq, but also SIMD, in case that was a blocker or something we wanted to consider.

Just leaving this here so we don't lose the linq (pun intended) in the future.