Ignore:
Timestamp:
Jul 20, 2011, 11:21:44 AM (14 years ago)
Author:
[email protected]
Message:

currentThread is too slow!
https://bugs.webkit.org/show_bug.cgi?id=64577

Reviewed by Darin Adler and Dmitry Titov.

The problem is that currentThread results in a pthread_once call which always takes a lock.
With this change, currentThread is 10% faster than isMainThread in release mode and only
5% slower than isMainThread in debug.

  • wtf/ThreadIdentifierDataPthreads.cpp:

(WTF::ThreadIdentifierData::initializeOnce): Remove the pthread once stuff
which is no longer needed because this is called from initializeThreading().
(WTF::ThreadIdentifierData::identifier): Remove the initializeKeyOnce call because
intialization of the pthread key should already be done.
(WTF::ThreadIdentifierData::initialize): Ditto.

  • wtf/ThreadIdentifierDataPthreads.h:
  • wtf/ThreadingPthreads.cpp:

(WTF::initializeThreading): Acquire the pthread key here.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r91351 r91380  
     12011-07-14  David Levin  <[email protected]>
     2
     3        currentThread is too slow!
     4        https://bugs.webkit.org/show_bug.cgi?id=64577
     5
     6        Reviewed by Darin Adler and Dmitry Titov.
     7
     8        The problem is that currentThread results in a pthread_once call which always takes a lock.
     9        With this change, currentThread is 10% faster than isMainThread in release mode and only
     10        5% slower than isMainThread in debug.
     11
     12        * wtf/ThreadIdentifierDataPthreads.cpp:
     13        (WTF::ThreadIdentifierData::initializeOnce): Remove the pthread once stuff
     14        which is no longer needed because this is called from initializeThreading().
     15        (WTF::ThreadIdentifierData::identifier): Remove the initializeKeyOnce call because
     16        intialization of the pthread key should already be done.
     17        (WTF::ThreadIdentifierData::initialize): Ditto.
     18        * wtf/ThreadIdentifierDataPthreads.h:
     19        * wtf/ThreadingPthreads.cpp:
     20        (WTF::initializeThreading): Acquire the pthread key here.
     21
    1222011-07-20  Mark Rowe  <[email protected]>
    223
Note: See TracChangeset for help on using the changeset viewer.