Bug 51612 - Add XML parser benchmark
Summary: Add XML parser benchmark
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Patrick R. Gansterer
URL:
Keywords:
Depends on: 51611
Blocks: 50516 50517
  Show dependency treegraph
 
Reported: 2010-12-25 14:45 PST by Patrick R. Gansterer
Modified: 2010-12-31 12:29 PST (History)
4 users (show)

See Also:


Attachments
Patch (3.21 KB, patch)
2010-12-25 14:52 PST, Patrick R. Gansterer
eric: review-
Details | Formatted Diff | Diff
Patch (14.89 KB, patch)
2010-12-26 14:36 PST, Patrick R. Gansterer
abarth: review+
abarth: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick R. Gansterer 2010-12-25 14:45:45 PST
see patch
Comment 1 Patrick R. Gansterer 2010-12-25 14:52:06 PST
Created attachment 77444 [details]
Patch

I'll commit manually to do a svn cp from html-parser.
Comment 2 Eric Seidel (no email) 2010-12-26 13:26:25 PST
Comment on attachment 77444 [details]
Patch

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

> WebCore/benchmarks/parser/xml-parser.html:69
> +function computeMedian(values) {
> +    values.sort(function(a, b) { return a - b; });
> +    var len = values.length;
> +    if (len % 2)
> +        return values[(len-1)/2];
> +    return (values[len/2-1] + values[len/2]) / 2;
> +}
> +
> +function computeMin(values) {
> +    var min = values.length ? values[0] : 0;
> +    for (var i = 1; i < values.length; i++) {
> +        if (min > values[i])
> +            min = values[i];
> +    }
> +    return min;
> +}
> +
> +function computeStdev(values) {
> +    var average = computeAverage(values);
> +    var sumOfSquaredDeviations = 0;
> +    for (var i = 0; i < values.length; ++i) {
> +        var deviation = values[i] - average;
> +        sumOfSquaredDeviations += deviation * deviation;
> +    }
> +    return Math.sqrt(sumOfSquaredDeviations / values.length);
> +}

Lets share all thsi stuff in a new .js file.  No need to copy/paste here.
Comment 3 Patrick R. Gansterer 2010-12-26 14:36:31 PST
Created attachment 77463 [details]
Patch

(In reply to comment #2)
> Lets share all thsi stuff in a new .js file.  No need to copy/paste here.
thx for the tip
Comment 4 Adam Barth 2010-12-31 01:37:53 PST
Comment on attachment 77463 [details]
Patch

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

Thanks.  I'll land this manually before moving these files to the new PerformanceTests folder.

> WebCore/benchmarks/parser/resources/runner.js:95
> +function start(rC, rF) {
> +    runCount = rC;
> +    runFunction = rF;
> +
> +    log("Running " + runCount + " times");
> +    run();
> +}

rC and rF are pretty short variable names.  Generally, we prefer to use real english words rather than abbreviations.  I'll tweak this during landing.
Comment 5 Adam Barth 2010-12-31 01:47:08 PST
Your patch is also incorrectly based.  Please create patches either with svn-create-patch or with webkit-patch to ensure they are properly based.
Comment 6 Adam Barth 2010-12-31 02:02:01 PST
Committed r74824: <http://trac.webkit.org/changeset/74824>
Comment 7 Patrick R. Gansterer 2010-12-31 02:54:33 PST
(In reply to comment #5)
> Your patch is also incorrectly based.
??? What is wrong?

> Please create patches either with svn-create-patch or with webkit-patch to ensure they are properly based.
I normally use git diff and it works without problems and in this case I used svn-create-patch.
Comment 8 Adam Barth 2010-12-31 12:29:08 PST
(In reply to comment #7)
> (In reply to comment #5)
> > Your patch is also incorrectly based.
> ??? What is wrong?

Hum...  Maybe the moves confused svn-apply?  I had to edit the patch manually to get it to apply.

> > Please create patches either with svn-create-patch or with webkit-patch to ensure they are properly based.
> I normally use git diff and it works without problems and in this case I used svn-create-patch.

Interesting.  The patch has a strange mix of forward and backward slashes.  Maybe that was the problem?