Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

With vector machines, Fortran yielded (much) faster code because (a) there was a whole lot of work on preprocessors for "dusty deck" code and (b) the lack of pointers and their overlap let the compilers do their stuff. C code needed a lot of #pragma's to let it know that some pointers didn't overlap and so could be optimized.

We found it best to to the front-end and I/O of the code in C and the compute in Fortran. Fastest calculations especially with those tailored libraries.

 help



Fortran certainly has its place, but if you really need to squeeze every bit of performance out of a machine I think assembly might be better and not much harder.

C allowed pointer aliasing, so you always have to refresh reads incase a pojnter modified the value. With any loop, that is just more reads to update dependancies every cycle. When not aliased, you cache value in register. Much later C introduced “restrict” keyword to match fortran performance code. c++ is still fighting this by insisting you work with different types, hence by default you dont get aliasing but that doesnt cover 100% of scenarios.

Maybe we get restrict in C++35




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: