The timing for any function in a tool like MATLAB depends on a huge number of things, not all of which are under the control of The MathWorks.
So what CPU do you have? How many cores are available? Is the function multi-threaded? Does it use operations that are multi-threaded? (Many operations are done so automatically, but only when the problem size issufficiently large for it to be a gain.) How much memory do you have? Cache?
That is just a subset of the machine dependent things I would consider. Then there are problem dependent questions. Some algorithms are problem size dependent, so algorithm switching is sometimes done. And some algorithms are themselves dependent on the data, running more efficiently on some data than on other data.
I'm sure there are some other factors I could think of, given some time. Don't forget things like function call overhead, which for small problems will be a dominant factor. And all of this is surely going to be release dependent for some functions, sicne there can always be changes made to compiled code as supplied.
It also means the only real measure of time is to run a test or series of tests on YOUR machine, on your release, on data that is consistent with the class of problems you will pose. Use the timeit function for the most consistent measure of time used.
1 件のコメント
Rik Wisselink (view profile)
このコメントへの直接リンク:
https://jp.mathworks.com/matlabcentral/answers/440613-what-is-time-efficiency#comment_662333
サインイン to comment.