Performance on par with Fortran 90/95
I have a couple of questions. I was a C/C++ programmer in the past and I used it for number crunching. After a friend of mine told me about Fortran 90/95 and how it outperforms C/C++ for number crunching, I switched to Fortran 90. He was right, I was able to get about 50% performance boost using Fortran compared to C/C++.
Due to the elegance and capabilities of C++, I kinda want to switch back but performance penalty is getting me worried.
Is there any way we can get number crunching performance on par with Fortran 90/95 on C++? I checked out Blitz++ libraries, they look nice but it looks like the development has stopped. Are there any performance libraries like Blitz++ but more modern?
I think the reason Fortran outperforms c++ is due to implicit vector/matrix operations and the ease of indexing on Fortran. Element-wise operations in C++ makes it not only run slower but also causes code to look less neat.
For example to take the exponential of an array, in C++ you have to do it element by element whereas in Fortran does it in one line, and the compiler makes use of that.
Any input would be appreciated.