Skip to content
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

No Generics #3

Open
AlanEvo opened this issue Mar 28, 2021 · 0 comments
Open

No Generics #3

AlanEvo opened this issue Mar 28, 2021 · 0 comments

Comments

@AlanEvo
Copy link
Owner

AlanEvo commented Mar 28, 2021

Not so much an issue but more a look into it at a later date. Original C++ version of chrono uses templates for the Matrix and other core classes, like Vector and Quaternion, so you can pass a int, float, double or long precision, now C# Generics work in a different way to C++ templates, C# uses full object oriented programming so templates are resolved and compile time whereas Generics continue into runtime.

So, the main problem I have here is that if I use Generics for the core classes you can not use mathematics unless I use the dynamic conversion. At the early time I didn't see an issue with this until I ran into cpu ms issues, when I ran some speed tests I noticed if I used a dynamic conversion on mathematics, eg.
T a;
T b;
a += (dynamic)b;
This appeared to run 20x slower than if it used doubles with not dynamic.
So for now the core classes are not Generic, it is just double precision type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant