How to benchmark Matlab processes?

前端 未结 3 1608
南笙
南笙 2020-12-15 06:33

Searching for an idea how to avoid using loop in my Matlab code, I found following comments under one question on SE:

The statement \"for loops are sl

3条回答
  •  不知归路
    2020-12-15 06:43

    The best tool for testing the performance of MATLAB code is Steve Eddins' timeit function, available here from the MATLAB Central File Exchange.

    It handles many subtle issues related to benchmarking MATLAB code for you, such as:

    • ensuring that JIT compilation is used by wrapping the benchmarked code in a function
    • warming up the code
    • running the code several times and averaging

    Update: As of release R2013b, timeit is part of core MATLAB.


    Update: As of release R2016a, MATLAB also includes a performance testing framework that handles the above issues for you in a similar way to timeit.

提交回复
热议问题