Why is MATLAB so fast in matrix multiplication?

前端 未结 12 1141
無奈伤痛
無奈伤痛 2020-11-22 00:29

I am making some benchmarks with CUDA, C++, C#, Java, and using MATLAB for verification and matrix generation. When I perform matrix multiplication with MATLAB, 2048x

12条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-22 01:06

    The general answer to "Why is matlab faster at doing xxx than other programs" is that matlab has a lot of built in, optimized functions.

    The other programs that are used often do not have these functions so people apply their own creative solutions, which are suprisingly slower than professionally optimized code.

    This can be interpreted in two ways:

    1) The common/theoretical way: Matlab is not significantly faster, you are just doing the benchmark wrong

    2) The realistic way: For this stuff Matlab is faster in practice because languages as c++ are just too easily used in ineffective ways.

提交回复
热议问题