Introducing the IE8 Developer Tools JScript profiler

Source: Internet
Author: User

Hello! I am Sameer chabungbam, one of the program managers on the JScript team.

The recently released beta 2 of Internet Explorer 8 contains a lot of improvements which are aimed at making developing Web applications on Internet Explorer 8 easier and more productive. one of these improvements is the JScript profiler in developer tools, which provides critical JScript related performance data to a web developer that helps identify and fix performance related issues. we believe the profiler is going to be a very helpful tool to fine tune the performance of the scripts in a web application. it is lightweight, easy-to-use and provides the following features:

• Provides performance data for JScript functions in two views:
Using Functions view-a flat listing of all the functions
Invalid call Tree View-a hierarchical listing of the functions based on the call flow
• Supports exporting the data to a file
• Provides an inferred name for anonymous Functions
• Profiles built-in JScript Functions
• Supports multiple profile reports
• Supports profiling implements SS page navigation and refreshes
This post gives an overview of the profiler and highlights some of its features. We hope you will try it out and give us your feedback.

Using the profiler
Launch the developer tools in Internet Explorer 8 either by pressing F12 or selecting 'developer tools 'from the tools dropdown on the command bar. switch to the profiler tab, and you can see the new script profiler. click the 'start profiling' button to begin a new profiling session.

 

Now, you can perform the scenario you want to profile, and JScript performance data will be collected by the profiler automatically in the background. note that the text of the button changes to 'stop filing' to indicate profiling is going on. to stop profiling, click the 'Stop profiling' button. the profiler will process the collected performance data and display a profile report for the session just concluded.

 

Viewing the profile report
The report presents the data in two views which can be selected from the current view dropdown:

• Functions view: This is a flat listing of all the functions with the corresponding performance data.
• Call Tree View: This is a hierarchical listing of the functions based on the call execution sequence. each node corresponds to a function and lists all the functions it called and the performance data for those CILS. the call tree view is useful in finding the call stack trace that has the greatest performance impact in your script.
In both views, each row corresponds to a JScript function, with the various performance data in different columns. the view can be customized to show different columns. right-click a column header and select 'add/remove columns 'to select the columns you want to view.

 

You can sort on any of the columns by clicking the corresponding column headers or by selecting the column from the 'sort by 'menu items in the right-click context menu.

The available columns are:

• Function: the name of the Function
• Count: the total number of callmade to this function
• Random sive time (MS): the time spent in this function and its children in milliseconds
• Aggressive time %: the percentage of time spent in this function and its children
• Exclusive time (MS): the time spent in this function in milliseconds
• Exclusive time %: the percentage of time spent in this function
• AVG time (MS): the average time spent in this function and its children in milliseconds
• Max time (MS): the maximum time spent in this function and its children in milliseconds
• Min time (MS): the minimum time spent in this function and its children in milliseconds
• URL: the URL of the source file where this function is defined
• Line number: The line number of the beginning of this function in the source file
Double-click a row to view the source code definition of the corresponding function in the script tab. this is available only if the performance data collects the URL Information and the source file is currently loaded in the script tab. you need to enable script debugging in Internet Explorer for the profiler to collect the URL Information. [Note: You can enable script debugging from the tools> Internet Options> Advanced Tab.]

 

Exporting data
Sometimes, we may want to analyze the profile report further, create graphs, or share it with another application. to facilitate this, the profiler allows the data to be exported to a file in a comma separated values (CSV) format. the data can then be opened in other applications (like Microsoft Office Excel) and can be shared. simply click the 'export data' button and give a filename to save the profile data of the current report to a file. note that presently only the functions view is exported and not the call Tree View.

Inferred name
In JavaScript, the function name is optional. you can define a function (called anonymous function) with no name. in practice, this is quite common. functions real-world JavaScript functions are defined in the context of an object literal, and more often than not, these are anonymous. this presents a problem in the profile report. when we have multiple anonymous entries, the only way to differentiate the anonymous functions is to look up the actual source definition of the functions from the URL and line number information. this is far from being convenient and makes the profile report hard to read and confusing.

To overcome this problem, the JScript profiler tries to infer a name for each anonymous function based on the context where the function is defined. Let me define strate how this works with the following example:

VaR shape = {
Area: function () {...} // anonymous function 1
};
Foo = function () {...} // anonymous function 2

When we profile this code, these functions will show up in the report as "area" and "foo" respectively, instead of both being listed as anonymous functions. this way, you can quickly identify which function is being referred to in the profile report without having to open the source code. the heuristic logic used to infer the name is simple enough to limit the performance overhead. in some cases, this might fail to infer a name, in which case, the function is listed with the special name "[anonymous]".

We hope the profiler comes handy when improving JavaScript performance of your Web applications in Internet Explorer. We look forward to your feedback.

Thanks!

Sameer chabungbam
Program Manager

Address: http://blogs.msdn.com/ B /ie/archive/2008/09/11/introducing-the-ie8-developer-tools-jscript-profiler.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.