Bug 85410 - Need tests for PerfTestRunner.computeStatistics
Summary: Need tests for PerfTestRunner.computeStatistics
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: Tom Zakrajsek
URL:
Keywords:
Depends on: 85435 85770
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-02 13:06 PDT by WebKit Review Bot
Modified: 2012-05-06 21:06 PDT (History)
2 users (show)

See Also:


Attachments
Patch (9.72 KB, patch)
2012-05-02 13:12 PDT, Tom Zakrajsek
no flags Details | Formatted Diff | Diff
Patch (10.33 KB, patch)
2012-05-02 15:50 PDT, Tom Zakrajsek
rniwa: review+
tomz: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description WebKit Review Bot 2012-05-02 13:06:13 PDT
Need tests for PerfTestRunner.computeStatistics
Requested by tomz on #webkit.
Comment 1 Tom Zakrajsek 2012-05-02 13:12:09 PDT
Created attachment 139867 [details]
Patch
Comment 2 Ryosuke Niwa 2012-05-02 13:29:18 PDT
Comment on attachment 139867 [details]
Patch

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

Thanks for the patch! I think we want one more iteration here.

> LayoutTests/fast/harness/perf-runner-compute-statistics.html:6
> +  <script src="../../fast/js/resources/js-test-pre.js"></script>
> +  <script src="../../../PerformanceTests/resources/runner.js"></script>
> +  <script type="text/javascript">

I would prefer not indent script elements like this.

> LayoutTests/fast/harness/perf-runner-compute-statistics.html:11
> +    /** Find the minimum value in an array of numbers.
> +     *
> +     * @param array     input array of numbers
> +     * @return          minimum value in array
> +     */

We don't normally add per-function comment like this.
It makes the code more verbose than needed.

> LayoutTests/fast/harness/perf-runner-compute-statistics.html:12
> +    Array.min = function(array) {

You should probably check that Array doesn't already have min.

> LayoutTests/fast/harness/perf-runner-compute-statistics.html:13
> +      return Math.min.apply(Math, array);

Please use 4-space indentation.

> LayoutTests/fast/harness/perf-runner-compute-statistics.html:33
> +      array.sort( function(a,b) {return a - b;} );

Please add spaces between { and return, and ; and }

> LayoutTests/fast/harness/perf-runner-compute-statistics.html:48
> +      return Array.sum(array)/array.length;

Space needed around /.

> LayoutTests/fast/harness/perf-runner-compute-statistics.html:58
> +      for (var a in array) {

Please don't use one-letter variable name like a.

> LayoutTests/fast/harness/perf-runner-compute-statistics.html:72
> +      for (var a in array) {

Ditto.

> LayoutTests/fast/harness/perf-runner-compute-statistics.html:95
> +      for (var a in array) {

Ditto.

> LayoutTests/fast/harness/perf-runner-compute-statistics.html:124
> +    /** Ensure no latent divide by 0's for an odd number of elements. */

Instead of adding comment like this. It's probably more helpful to put it in debug().

> LayoutTests/fast/harness/perf-runner-compute-statistics.html:138
> +    /** This test will catch if any order dependencies in the data, such as
> +     *  needing to be numerically sorted, are not resolved by the algorithm.
> +     *  This variant covers an odd number of elements.
> +     */

Ditto.

> LayoutTests/fast/harness/perf-runner-compute-statistics.html:159
> +    /** This test will catch if any order dependencies in the data, such as
> +     *  needing to be numerically sorted, are not resolved by the algorithm.
> +     *  This variant covers an odd number of elements, and negative values.
> +     */

Ditto.

> LayoutTests/fast/harness/perf-runner-compute-statistics.html:204
> +  <script type="text/javascript">
> +    // runner.js marks this as an async test so we need to call notifyDone.
> +    layoutTestController.notifyDone();
> +  </script>

We can merge this into the script element above, no?
Comment 3 Tom Zakrajsek 2012-05-02 15:50:01 PDT
Created attachment 139898 [details]
Patch
Comment 4 Ryosuke Niwa 2012-05-02 15:52:24 PDT
Comment on attachment 139898 [details]
Patch

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

> LayoutTests/fast/harness/perftests/perf-runner-compute-statistics.html:15
> +        // don't want side effects on the input array, so...

Please don't abbreviate "original".

> PerformanceTests/resources/runner.js:2
> +// There are tests for computeStatistics() located in
> +// LayoutTests/fast/harness/perftests

You can probably fit this in one line.
Comment 5 Tom Zakrajsek 2012-05-02 16:08:01 PDT
Committed r115905: <http://trac.webkit.org/changeset/115905>
Comment 6 Ryosuke Niwa 2012-05-02 21:25:33 PDT
Reopen the bug since the patch was rolled out in http://trac.webkit.org/changeset/115917
Comment 7 Tom Zakrajsek 2012-05-02 23:43:04 PDT
Committed r115942: <http://trac.webkit.org/changeset/115942>
Comment 8 WebKit Review Bot 2012-05-06 20:54:51 PDT
Re-opened since this is blocked by 85770
Comment 9 Tom Zakrajsek 2012-05-06 21:06:03 PDT
This was reopened while testing "rollout" capability.  This fix was good and the rollout patch was cancelled after it was verified.  This bug remains fixed.