Improve performance of -profile by factor of 10

Walter Bright newshound2 at digitalmars.com
Mon Mar 25 22:01:03 PDT 2013


On 3/25/2013 8:01 PM, Vladimir Panteleev wrote:
> On Tuesday, 26 March 2013 at 02:57:07 UTC, Walter Bright wrote:
>> While you can get the caller (after all, debuggers do it), it can be
>> arbitrarily costly (in terms of execution speed) to do so, which can negate
>> many of the advantages of a probing profiler.
>
> What? You just read the value EBP is pointing at, or something like that.
> Walking the call stack is basically walking a linked list.

If only it were that simple.

1. many stack frames do not have an EBP

2. the stack frames on Win64 require doing a bunch of table searches to figure 
out - they don't use EBP

3. even when you find the return address, then it's a costly process to figure 
out what function that address belongs in

>> The ones I've seen didn't bother to do it.
>
> Maybe they just weren't very good profilers ;) I've tried a few before I found
> Very Sleepy.
>
>> Fan in/out is very useful because the most effective optimization is to not
>> call the time consuming functions, and this path information enables you to
>> figure out where you don't really need to call it.
>
> Who's arguing that?

Just wanted to point out how useful it is!



More information about the Digitalmars-d mailing list