How to evaluate overall memory consumption and number of computations of a code?
1 view (last 30 days)
Show older comments
Hi, I am trying to compare two different image processing techniques, the performance results of which are identical. But I need to compare coding performance on the scale of memory consumption and the number of computations involved. Is it possible in matlab?
0 Comments
Answers (3)
KSSV
on 8 Mar 2017
To check the performance of code read about profile. for memory related read about whos, memory.
0 Comments
Walter Roberson
on 8 Mar 2017
No.
If you are using MS Windows then you can call memory() at various times. However that will not tell you peak memory use, as many operations create temporary results. Os-x and Linux do not have access to this call.
It has not really been feasible to measure operations used since MIPS introduced multiple execution units in their CPUs in the early 1990s. Some people would push the date even further back to the introduction of the Sun Microsystems SPARC in the mid 1980s.
There is a third party package that you can use to sort of annotate your code, and it can count theoretical floating point operations for a few standard calculations. It cannot, for example, tell you how efficient the \ operation is.
0 Comments
Jan
on 8 Mar 2017
compare coding performance on the scale of memory consumption and the number of computations
involved. Is it possible in matlab?
No. The term "memory consumption" is not exactly defined. It matters if the chunks of the processed data match into a cache-line, or the other memory caches, or if temporary memory must be stored by disk swapping. Loading large files consumes temporary memory by the automatic disk-caching controlled by the operating system. This can have side-effects for the dynamic allocation of memory inside Matlab also.
The number of computations can change with the processor and the size of the input data in a non-linear way: Some Matlab function use multi-threaded methods if the input size exceeds a certain limit. And as soon as multi-threading is applied, "number of computations" is not exactly defined anymore.
I examined exactly, the definition and determination of the computational performance becomes an extremely complicated problem. So start at defined, what you exactly need for you comparisons. Using a stop watch might be the most reliable technique.
0 Comments
See Also
Categories
Find more on Performance and Memory in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!