-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Update Time.cs #183
Update Time.cs #183
Conversation
Is this something that you have measured? Rewriting parts of SFML instead of direct calls, has a maintenance cost and should only be done if really necessary. |
I specifically discovered the performance hit when using
When SFML 3 becomes available, I plan to remove the use of |
While I see the cost for re-implementing code, I do think this one is justified, given that it's quite common to call the conversion functions a lot and you wouldn't expect P/Invoke calls for such a simple operation. |
Any further thoughts on this? |
I know it's not the case here, but if
|
Those 2 formulas yield the same result even with non-multiples of 1000
|
In floating-point arithmetic yes, not with integer division -- unless C# has different rules than C++ for that. |
Added conversions to and from .NET's TimeSpan struct Significantly reduced P/Invoke calls, which now only happen during construction and conversion
Fair enough. Formula changed and PR updated. |
Added conversions to and from .NET's TimeSpan struct
Significantly reduced P/Invoke calls, which now only happen during construction and conversion
This should yield performance gains in any place where Time is being used. Additionally, this is a bit of futureproofing for SFML3, as Time is likely to be removed, and the TimeSpan struct has existed in .NET since Framework 1.0