Bug 52222 - Microoptimization in ~JSString
Summary: Microoptimization in ~JSString
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-11 09:45 PST by Xan Lopez
Modified: 2011-01-11 10:52 PST (History)
1 user (show)

See Also:


Attachments
jsstringdtor.diff (2.94 KB, patch)
2011-01-11 09:49 PST, Xan Lopez
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Xan Lopez 2011-01-11 09:45:53 PST
ssia.
Comment 1 Xan Lopez 2011-01-11 09:49:41 PST
Created attachment 78544 [details]
jsstringdtor.diff

Small optimization in the JSString dtor. SunSpider results:


TEST                   COMPARISON            FROM                 TO             DETAILS

=============================================================================

** TOTAL **:           1.003x as fast    275.4ms +/- 0.1%   274.7ms +/- 0.1%     significant

=============================================================================

  3d:                  -                  36.4ms +/- 0.5%    36.2ms +/- 0.5% 
    cube:              -                  11.9ms +/- 1.0%    11.8ms +/- 1.0% 
    morph:             -                  11.2ms +/- 0.6%    11.2ms +/- 0.6% 
    raytrace:          -                  13.2ms +/- 0.5%    13.2ms +/- 0.5% 

  access:              -                  38.7ms +/- 0.2%    38.7ms +/- 0.2% 
    binary-trees:      ??                  3.7ms +/- 2.0%     3.7ms +/- 2.0%     not conclusive: might be *1.002x as slow*
    fannkuch:          -                  19.0ms +/- 0.1%    19.0ms +/- 0.0% 
    nbody:             -                  11.0ms +/- 0.0%    11.0ms +/- 0.0% 
    nsieve:            -                   5.0ms +/- 0.0%     5.0ms +/- 0.0% 

  bitops:              ??                 23.6ms +/- 0.3%    23.7ms +/- 0.3%     not conclusive: might be *1.002x as slow*
    3bit-bits-in-byte: -                   3.0ms +/- 0.0%     3.0ms +/- 0.0% 
    bits-in-byte:      -                   6.0ms +/- 0.0%     6.0ms +/- 0.0% 
    bitwise-and:       ??                  5.6ms +/- 1.4%     5.7ms +/- 1.4%     not conclusive: might be *1.008x as slow*
    nsieve-bits:       -                   9.0ms +/- 0.1%     9.0ms +/- 0.0% 

  controlflow:         -                   2.0ms +/- 0.0%     2.0ms +/- 0.0% 
    recursive:         -                   2.0ms +/- 0.0%     2.0ms +/- 0.0% 

  crypto:              -                  16.0ms +/- 0.1%    16.0ms +/- 0.1% 
    aes:               -                  10.0ms +/- 0.0%    10.0ms +/- 0.0% 
    md5:               -                   3.0ms +/- 0.6%     3.0ms +/- 0.6% 
    sha1:              -                   3.0ms +/- 0.0%     3.0ms +/- 0.0% 

  date:                ??                 31.4ms +/- 0.3%    31.4ms +/- 0.3%     not conclusive: might be *1.001x as slow*
    format-tofte:      -                  16.0ms +/- 0.2%    16.0ms +/- 0.2% 
    format-xparb:      ??                 15.3ms +/- 0.5%    15.4ms +/- 0.6%     not conclusive: might be *1.003x as slow*

  math:                -                  29.0ms +/- 0.1%    29.0ms +/- 0.1% 
    cordic:            ??                  9.0ms +/- 0.3%     9.0ms +/- 0.4%     not conclusive: might be *1.001x as slow*
    partial-sums:      -                  15.0ms +/- 0.0%    15.0ms +/- 0.1% 
    spectral-norm:     -                   5.0ms +/- 0.0%     5.0ms +/- 0.0% 

  regexp:              ??                 12.5ms +/- 0.6%    12.6ms +/- 0.6%     not conclusive: might be *1.005x as slow*
    dna:               ??                 12.5ms +/- 0.6%    12.6ms +/- 0.6%     not conclusive: might be *1.005x as slow*

  string:              1.008x as fast     85.8ms +/- 0.1%    85.1ms +/- 0.1%     significant
    base64:            -                   9.0ms +/- 0.1%     9.0ms +/- 0.0% 
    fasta:             1.052x as fast     12.0ms +/- 0.2%    11.4ms +/- 0.7%     significant
    tagcloud:          -                  21.8ms +/- 0.3%    21.7ms +/- 0.3% 
    unpack-code:       -                  32.0ms +/- 0.1%    32.0ms +/- 0.1% 
    validate-input:    -                  11.0ms +/- 0.2%    11.0ms +/- 0.2%
Comment 2 Darin Adler 2011-01-11 10:16:27 PST
Comment on attachment 78544 [details]
jsstringdtor.diff

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

> Source/JavaScriptCore/runtime/JSString.h:324
> +                do {
> +                    RopeImpl::deref(m_other.m_fibers[i]);
> +                } while (++i < m_fiberCount);

One line body, usually no braces in WebKit coding style.
Comment 3 Xan Lopez 2011-01-11 10:52:19 PST
(In reply to comment #2)
> (From update of attachment 78544 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=78544&action=review
> 
> > Source/JavaScriptCore/runtime/JSString.h:324
> > +                do {
> > +                    RopeImpl::deref(m_other.m_fibers[i]);
> > +                } while (++i < m_fiberCount);
> 
> One line body, usually no braces in WebKit coding style.

You are right; for some reason the do without the braces seemed weird, but it goes against the style guidelines. Committed with that fix as http://trac.webkit.org/changeset/75517
Comment 4 Xan Lopez 2011-01-11 10:52:33 PST
Closing.