<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - JavaScriptCore performance is very bad on Windows"
href="https://bugs.webkit.org/show_bug.cgi?id=146448#c33">Comment # 33</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - JavaScriptCore performance is very bad on Windows"
href="https://bugs.webkit.org/show_bug.cgi?id=146448">bug 146448</a>
from <span class="vcard"><a class="email" href="mailto:peavo@outlook.com" title="peavo@outlook.com">peavo@outlook.com</a>
</span></b>
<pre>Below is the MSVC implementation of _Thrd_current(), which is called by std::this_thread::get_id(). It's the DuplicateHandle() call which is time consuming according to the profiler. The code for _WIN32_WCE just calls GetCurrentThreadId(), which is faster. This is basically what we do with this patch.
_Thrd_t _Thrd_current(void)
{ /* return _Thrd_t identifying current thread */
_Thrd_t thr;
#ifdef _WIN32_WCE
thr._Hnd = (HANDLE)GetCurrentThreadId();
#elif defined(_CRT_APP) && !defined(_KERNELX)
thr._Hnd = (HANDLE)__crtGetCurrentWinRTThread();
#else /* _WIN32_WCE */
if (DuplicateHandle(GetCurrentProcess(), GetCurrentThread(),
GetCurrentProcess(), &thr._Hnd,
DUPLICATE_SAME_ACCESS, TRUE, 0))
CloseHandle(thr._Hnd);
else
thr._Hnd = 0;
#endif /* _WIN32_WCE */
#if defined(_CRT_APP) && !defined(_KERNELX)
thr._Id = __crtGetCurrentWinRTThreadId();
#else /* defined(_CRT_APP) && !defined(_KERNELX) */
thr._Id = GetCurrentThreadId();
#endif /* defined(_CRT_APP) && !defined(_KERNELX) */
return (thr);
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>