[prev in list] [next in list] [prev in thread] [next in thread] 

List:       webkit-dev
Subject:    Re: [webkit-dev] When should I use AtomicString vs String?
From:       Ryosuke Niwa <rniwa () webkit ! org>
Date:       2013-05-31 23:32:07
Message-ID: CABNRm60h1uA4EsvcSZcXaPZE8Uqb4F_=5zVDF3yBXx+0nmC7_g () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


We shouldn't use AtomicString if the string we're about to create doesn't
get shared across multiple AtomicStrings.

For example, if we had used AtomicString for the strings inside Text nodes,
then we may end up filling up the atomic string table with all these really
long strings that don't typically appear more than once.  It also slows
down the hash map look up for all other atomic strings.

On Fri, May 31, 2013 at 3:00 PM, Brendan Long <self@brendanlong.com> wrote:

>  So should I just never use String and always use AtomicString?
>
>
> On 05/31/2013 03:14 PM, Daker Pinheiro wrote:
>
> It is faster to compare and hash AtomicString than regular Strings.
>
>
> On Fri, May 31, 2013 at 5:57 PM, Brendan Long <self@brendanlong.com>wrote:
>
>> I hope this isn't a stupid question, but I can't find any references to
>> what the difference between AtomicString and String is. It looks like
>> AtomicString is generally preferred, but I don't know why. Can someone
>> fill me in on this? Is there any refences for the classes in WTF?
>>
>>
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev@lists.webkit.org
>> https://lists.webkit.org/mailman/listinfo/webkit-dev
>>
>>
>
>
>  --
> Daker Fernandes Pinheiro
> http://codecereal.blogspot.com
>
>
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev@lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev
>
>

[Attachment #5 (text/html)]

<div dir="ltr"><div class="gmail_extra">We shouldn&#39;t use AtomicString if the \
string we&#39;re about to create doesn&#39;t get shared across multiple \
AtomicStrings.</div><div class="gmail_extra"><br></div><div class="gmail_extra">

For example, if we had used AtomicString for the strings inside Text nodes, then we \
may end up filling up the atomic string table with all these really long strings that \
don&#39;t typically appear more than once.  It also slows down the hash map look up \
for all other atomic strings.</div>

<div class="gmail_extra"><br></div><div class="gmail_extra"><div \
class="gmail_quote">On Fri, May 31, 2013 at 3:00 PM, Brendan Long <span \
dir="ltr">&lt;<a href="mailto:self@brendanlong.com" \
target="_blank">self@brendanlong.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>So should I just never use String and
      always use AtomicString?<div><div class="h5"><br>
      <br>
      On 05/31/2013 03:14 PM, Daker Pinheiro wrote:<br>
    </div></div></div><div><div class="h5">
    <blockquote type="cite">
      <div dir="ltr">It is faster to compare and hash AtomicString than
        regular Strings.</div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Fri, May 31, 2013 at 5:57 PM,
          Brendan Long <span dir="ltr">&lt;<a href="mailto:self@brendanlong.com" \
target="_blank">self@brendanlong.com</a>&gt;</span>  wrote:<br>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I \
hope  this isn&#39;t a stupid question, but I can&#39;t find any
            references to<br>
            what the difference between AtomicString and String is. It
            looks like<br>
            AtomicString is generally preferred, but I don&#39;t know why.
            Can someone<br>
            fill me in on this? Is there any refences for the classes in
            WTF?<br>
            <br>
            <br>
            _______________________________________________<br>
            webkit-dev mailing list<br>
            <a href="mailto:webkit-dev@lists.webkit.org" \
                target="_blank">webkit-dev@lists.webkit.org</a><br>
            <a href="https://lists.webkit.org/mailman/listinfo/webkit-dev" \
target="_blank">https://lists.webkit.org/mailman/listinfo/webkit-dev</a><br>  <br>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        Daker Fernandes Pinheiro<br>
        <a href="http://codecereal.blogspot.com" \
target="_blank">http://codecereal.blogspot.com</a><br>  <br>
      </div>
    </blockquote>
    <br>
  </div></div></div>

<br>_______________________________________________<br>
webkit-dev mailing list<br>
<a href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a><br>
<a href="https://lists.webkit.org/mailman/listinfo/webkit-dev" \
target="_blank">https://lists.webkit.org/mailman/listinfo/webkit-dev</a><br> \
<br></blockquote></div><br></div></div>



_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic