Speed of exception throwing and catching

7 次查看(过去 30 天)
Hi,
I'm trying to analyse the exact time involved in throwing and catching an exception (I've used the profiler practically to get time in ms, but am interested in how and why this corresponds to clock cyles, I'm just trying to get a more theoretical understanding). I'm looking for an exact number of clock cycles.
How many clock cycles are used to throw an exception and how many clock cycles are used to catch that exception and what does on during the throwing/catching process to cause those clock cycles to be used?
With many thanks,
Froskoy.

回答(1 个)

Jan
Jan 2012-7-12
I'm convinced, that PROFILE does not allow to measure processor cycles for specific commands. On one hand PROFILE disables the JIT acceleration, on the other hand the clock used by PROFILE has a course precision only (0.01 or 0.001 sec, as far as I remember).
The FEX: High-Accuracy-Timer offers a higher precision under Windows. But this program has a distinct overhead itself, such that you have to be very careful.
I'm using TRY/CATCH to save hours (days!) of debugging, therefore I do not care much about processor cycles as long as my 200'000 lines of code program runs in less than 5 seconds.
  2 个评论
Matthew
Matthew 2012-7-12
Thanks. I've edited for clarity RE the profiler. I'm more interested in details of how exceptions are implemented in the MATLAB language and how this corresponds to number of clock cycles taken to execute the code.
Do you also know of a good memory analyser (external to MATLAB) that I can use to see where MATLAB is allocating memory?
Jan
Jan 2012-7-12
I assume that all tools I know violate the license conditions, which forbid a reverse engineering.
On the other hand (at least) in earlier Matlab versions (2009a as far as I remember) you can enable different memory managers at startup. But adjusting a Matlab program to a specific memory manager is not a good idea, because the next Matlab release could use a different approach already.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by