I am doing raytracing. I have not measured any performance numbers. I am thinking of making a separate C function for raytracing and then calling it from my matlab code.
Does it make the program perform better if instead of writing Matlab code?
If it is a well-written MATLAB code (meaning it takes advantage of matrix multiplication wherever possible) than MATLAB usually performs better than C. I remember a professor in college showing us MATLAB could beat even FORTRAN in calculating eigenvectors.
This is speaking typically though; there may be parts of your program that C could perform faster than MATLAB, although typically speaking MATLAB does just as well for well-written code. Here's an example of some very specific benchmarking done at MIT: http://www.ll.mit.edu/HPEC/agendas/proc03/pdfs/nehrbass.pdf
精彩评论