Safari, as of version 4, provides a profiler in addition to other tools, including a network analyzer, as part of its bundled Web Inspector. Like the Internet Explorer Developer Tools, the Web Inspector profiles native functions and provides an expandable call tree. It also includes a Firebug-like console API with profiling functionality, and a Resource panel for network analysis.
To access the Web Inspector, first make sure that the Develop menu is available. The Develop menu can be enabled by opening Preferences → Advanced and checking the “Show Develop menu in menu bar” box. The Web Inspector is then available under Develop → Show Web Inspector (or the keyboard shortcut Option-Command-I).
Clicking the Profile button brings up the Profile panel (Figure 10-6). Click the Enable Profiling button to enable the Profiles panel. To start profiling, click the Start Profiling button (the dark circle in the lower right). Click Stop Profiling (same button, now red) to stop the profile and show the report.
You can also type Option-Shift-Command-P to start/stop profiling.
Figure 10-6. Safari Web Inspector Profile panel
console.time(), etc.) in order to start and stop profiling programmatically. The functionality is the same as Firebug’s, allowing you to name reports and timings for better profile ...