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

Fortran-like performance (use of "restrict") #3

Open
dumblob opened this issue Oct 30, 2020 · 0 comments
Open

Fortran-like performance (use of "restrict") #3

dumblob opened this issue Oct 30, 2020 · 0 comments

Comments

@dumblob
Copy link

dumblob commented Oct 30, 2020

The main difference (or rather the only one?) between Fortran and C is, that Fortran's semantics assumes no pointer aliasing by default (though Fortran as a language allows pointer aliasing) whereas C assumes pointer aliasing is always present.

Pointer aliasing is on of the few major complications almost preventing vectorization and thus the reason why C is so slow and hard to optimize.

To make exceptions to this C semantics rule, restrict appeared in C99. Unfortunately restrict might be quite error prone and thus it's being used mostly in macros or automatically generated code but much less manually. But V generates C, so this is great opportunity for major performance boost in certain use cases and a numerical library should be one of them.

I think to make vnum have excellent performance, restrict will be necessary. See the corresponding V issue proposing using restrict as an important optimization.

Thoughts?

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