Using System.Numerics

Would it be a bad idea to use the existing System.Numerics classes for ao Vector and matrix classes?
Quickly looking at both the Microsoft and the Paradox versions, they seem to cover much of the same ground.

If System.Numerics is in the portable subset I don’t see an issue, just keep in mind that you’ll need to convert vectors and matrices to paradox vectors and matrices to use them in paradox which could reduce performance depending on what you are doing.

Thanks for the quick reply, but I didn’t mean to ask if I could use it in my personal project.
I meant to find out why Paradox chose to re-implement most of these classes instead of using the existing ones.

Hi Boris,

Good question.

Paradox has been developed much before System.Numerics came out, so that’s one the reasons why we haven’t been using it! :wink:

Also, there is kind of design flaw in the current System.Numerics that I have reported a long time ago (but maybe I should report it a bit more now that it is on github), is that they are not providing methods with by ref parameters (like the Matrix.Multiply), so things are far from being optimized as it implies copying around on the stack lots of data which is quite inefficient. In Paradox, we have many methods for this scenario.

That being said, we will keep an eye on System.Numerics and we may switch to it at some point if it meets enough of our performance concerns.

Ah yes, I think we had this conversation before or I saw your comments on the original library (before it was system.numerics)

My first thought would be that it isn’t by ref because thread safety, no?

1 Like

Wow, whole can of worms ey :neutral_face:

ah thanks, I remember that you started this github issue but forgot to contribute to it at that time! :wink: