-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposition to port math to native implementation #6616
Comments
@RUSshy could you give it a try with System.Numerics? That should boost the numbers some more. |
Real world benchmarks on complete games would be more relevant to assess this (my guess is that most games will have the GPU clogged way before the CPU becomes a limitation). Please note that proposing native implementations for parts of MonoGame must cover all platforms, including consoles (or be optional). |
For what it's worth, here's my timings for the toy program with .NET Core 2.0:
|
That is my first concern. Replacing our portable C# with something that isn't portable. Second MonoGame is a C# library and ideally we should be dogfooding as much as possible. IMO we should use C# where ever we can.
Wow... i'm surprised Numerics is that much faster. |
Then clearly porting the MonoGame math library is out of the question now, but now I have two questions:
|
There's also the Nintendo Switch. |
@OptimisticPeach - We run on all the current gen consoles plus Vita and expect to be on all the upcoming 9th generation of consoles (PS5, etc). We have some talk of trying to get MG on Nintendo 3DS, but so far no work on that has started. |
Hmm, here's a table I just compiled for target that rust supports (or doesn't, or I'm not sure about)
And so, there doesn't seem to be full support for everything you're targeting, one of the big ones is PlayStation, and that seems to be an important target for MonoGame, so I think that porting anything in the main library over is out of question, unless we set up a hacky target check, but that doesn't seem to nice. Either way, I'd be happy work on anything that might need to be faster, and FFIing with a native language like rust. Edit: |
I agree with @mrhelmut
I'm against burdening ourselves with native dependencies and offering up portability for speculative performance gains in very specific situations. IMO we can close this. On a related note, I'm in favor of moving to System.Numerics from MG's vector/matrix classes in the future. Still, thanks for looking into this @OptimisticPeach :) |
Well, that's alright, it was just an idea, anyway, I'm going to close this issue as @Jjagg mentioned, and I think I might try my hand at building something in MonoGame again. Perhaps in a few years I'll re-open this if the situation changes. |
I've used MonoGame for about a year, but then decided to switch languages, and ended up on
Rust
.I have missed MonoGame, but I don't really want to leave Rust as it's an amazing programming language. So I came up with the idea to integrate rust with MonoGame, and thought that perhaps the math portion could be ported for ease of use instead of anything too complicated to put into an FFI. I wrote a test and, low and behold, I have great results:
Matrix.CreateLookAt()
Here is my configuration for reference:
--release
So I'm asking, if I were to rewrite alot of the math functions in MonoGame in Rust, would it ever be accepted? (Of course I'd make sure to keep the implementation outputting the same result)
The source for my tests
Edit:
I later realized, that while rust does compile to many platforms, it doesn't compile to all, so it may not have support for some of the less prominent targets that MonoGame targets.
Edit 2:
I was actually looking at DateTime for ticks per second, but I was actually using the StopWatch.Frequency ticks per second
The text was updated successfully, but these errors were encountered: