You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is purely an optimization question, not a bug.
A number of places like the ISO code use the pattern:
ix = val % 10;
val /= 10;
From what digging I could do, .Net doesn't optimize this nearly as well as one might hope. However, there's already a .Net built-in to do both operations at once, introduced in .Net 2.0:
I've not tried it, but I'm curious if it would perform more optimally than the large number of % then / in ISO, int, etc code.
If not, as you likely know there are many optimizations for the combined operation out there, including several that are specific to narrow ranges of inputs, which ISO dates in particular exhibit:
This is purely an optimization question, not a bug.
A number of places like the ISO code use the pattern:
ix = val % 10;
val /= 10;
From what digging I could do, .Net doesn't optimize this nearly as well as one might hope. However, there's already a .Net built-in to do both operations at once, introduced in .Net 2.0:
http://msdn.microsoft.com/en-us/library/yda5c8dx.aspx
I've not tried it, but I'm curious if it would perform more optimally than the large number of % then / in ISO, int, etc code.
If not, as you likely know there are many optimizations for the combined operation out there, including several that are specific to narrow ranges of inputs, which ISO dates in particular exhibit:
http://embeddedgurus.com/stack-overflow/2011/02/efficient-c-tip-13-use-the-modulus-operator-with-caution/
Including some extremely specialized ones if you happen to be dividing by a power of two:
http://blog.teamleadnet.com/2012/07/faster-division-and-modulo-operation.html
Just some thoughts on possible remaining optimizations. Exciting library!
The text was updated successfully, but these errors were encountered: