Hi Yong,

On 12 July 2011 18:10, Yong Li <yong.li.web...@gmail.com> wrote:
> Another slow case is converting a const C string to WTF::String every
> time. For example,
>
>    return (m_httpHeaderFields.contains("If-Match") ||
>            m_httpHeaderFields.contains("If-Modified-Since") ||
>            m_httpHeaderFields.contains("If-None-Match") ||
>            m_httpHeaderFields.contains("If-Range") ||
>            m_httpHeaderFields.contains("If-Unmodified-Since"));
>
> This function creates 5 Strings (calls fastMalloc 5 times), and also
> calculates the hash key 5 times, and then throws them away.

In this case, the code already indicates it is not optimal:

HTTPHeaderMap.h:
// Alternate accessors that are faster than converting the char* to
AtomicString first.
bool contains(const char*) const;

Also this converting can probably be fixed by using
DEFINE_STATIC_LOCAL(AtomicString,...).
Cheers,

Rob.
_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to