JSX

a faster, safer, easier JavaScript
Powered by Oktavia

Using the Profiler

JSX has a built-in profiler that helps the developers track down the bottlenecks and tune their web applications. The profiler is able to display the results in three modes: Call Tree, Interted Call Tree, Functions. For each function, call count, inclusive and exclusive times spent are displayed.

Profiling the Application

Follow the steps to profile your application.

Step 1. Add code that uploads the profile. The code snippet below will post the profile information to the profile server running at localhost:2012 after running the application for 10 seconds (10,000 milliseconds).

if (JSX.profilerIsRunning()) {
    dom.window.setTimeout(function () : void {
        JSX.postProfileResults("http://localhost:2012/post-profile");
    }, 10000);
}

Step 2. Compile the application with --profile.

$ jsx --profile --release mywebapp.jsx

Step 3. Run the profile server. The server will bind to TCP port 2012.

$ jsx-profile-server
# or `jsx-profile-server 8080` will listen the port 8080

Step 4. Run the application. When JSX.postProfileRelust() succeeds, you wil find a line like below in the console.

Open http://localhost:2012/web/profiler.html?20120626010422

Step 5. Open the URL specified in the console, and you will find the profile results.