0

I am trying to optimize a script and I'm using firebug profiler to see what functions use most time to start from there.

My problem is that the script uses jQuery and raphaeljs and their functions, events etc are listed as "anonymous". All of them.

As you can see in the image below everything I defined appears with name.

Here's a image of what I see (the image is readable just zoom a bit (ctrl + "+")).

enter image description here

Since I don't plan to modify jQuery or raphael I don't really care what's the name of the function called (tho it would be nice to know) but I'm really interested on where did that function has been called from (to see if I can reduce the number of calls or something). Any idea how to do that?

Thank you for your help.

2 Answers 2

3

In Firebug, use the stack panel to identify who is calling and who has been called. During the debug process, use the unminified version of the scripts in order to breakpoint in the proper positions.

Sign up to request clarification or add additional context in comments.

4 Comments

The script -> stack ? How do I do that... is always empty in my window.
I tried in chrome also... the stack trace is "undefined undefined undefined undefined etc.". Any suggestions? :(
Stack activates only on errors/pause... can I change this behavior somehow?
I opened firebug in this same page. I added a breakpoint in the quant.js script. Then I reloaded the page. The script execution stopped at the breackpoint. In the right panel of Firebug I clicked the 'stack' tab to display the stacktrace.
2

To find which function called the current function use this :

alert(arguments.callee.caller.name);

This will alert the name of caller function. You can also use hierarchy like this :

arguments.callee.caller.caller.name 

2 Comments

+1 for general usefulness but the I know what function I call and need to know what it calls in different scenarios (depending on parameters the function calls a bunch of other functions and so are they, etc, etc... you get the point). So I need to do the oposite of what you said (that's why I was using profiler but that anonymus is a blocker).
Seems strange..!! only debugging can be useful in this case then. depending on params, try to dryrun the flow.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.