Bug 98561 - Perf test pesults page takes forever to load on a machine with a slow Internet connection
Summary: Perf test pesults page takes forever to load on a machine with a slow Interne...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords:
Depends on:
Blocks: 77037
  Show dependency treegraph
 
Reported: 2012-10-05 15:03 PDT by Ryosuke Niwa
Modified: 2012-10-08 12:01 PDT (History)
4 users (show)

See Also:


Attachments
Patch (4.96 KB, patch)
2012-10-05 15:05 PDT, Ryosuke Niwa
ojan: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2012-10-05 15:03:19 PDT
Right now, perf. tests' results page tries to load both local and remote files. As a result, when your computer is connected to a really slow network (e.g. public WiFi), it could take ages to load because it pauses the parser.

We should dynamically load scripts asynchronously.
Comment 1 Ryosuke Niwa 2012-10-05 15:05:21 PDT
Created attachment 167394 [details]
Patch
Comment 2 Ojan Vafai 2012-10-05 15:25:21 PDT
Comment on attachment 167394 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=167394&action=review

> PerformanceTests/resources/results-template.html:514
> +(function () {

You probably want to move this whole block close to the top of the file so that we start doing the network request ASAP.

> PerformanceTests/resources/results-template.html:538
> +            loadScript(prefix + '/' + plugins[i], function () {
> +                numberOfLoadedPlugins++;
> +                if (numberOfLoadedPlugins == plugins.length)
> +                    init();
> +            }, (function (plugin) {
> +                return function () { alert("Failed to load " + plugin); }
> +            })(prefixes[i]));

These nested function calls are really hard to read. Can you make a local named helper function?

> PerformanceTests/resources/results-template.html:542
> +    var prefixes = ['%AbsolutePathToWebKitTrunk%', 'https://svn.webkit.org/repository/webkit/trunk'];

Instead of trying both, could you try the local one first and only do the network one if that fails? The local once should error out pretty quickly when it's not available.

> PerformanceTests/resources/results-template.html:556
> +        loadScript(prefixes[i] + '/' + jQuery, (function (prefix) {
> +            return function () {
> +                if (!startedLoadingPlugins)
> +                    loadPlugins(prefix);
> +                startedLoadingPlugins = true;                
> +            }
> +        })(prefixes[i]), function () {
> +            numberOfFailures++;
> +            if (numberOfFailures == prefixes.length)
> +                alert("Failed to load jQuery.");
> +        });

Ditto. Hard to read. It would also help if you put the second argument to loadScript on a newline after the comma.
Comment 3 Ryosuke Niwa 2012-10-08 12:01:52 PDT
Committed r130669: <http://trac.webkit.org/changeset/130669>