New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 898294 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Oct 25
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

PlatformThread::CurrentId is slow

Project Member Reported by dtapu...@chromium.org, Oct 23

Issue description

PlatformThread::CurrentId on linux uses a syscall. The value can be easily cached in some TLS under some assumptions.

1) We need to invalidate the cache at fork time
2) clone() isn't used in the chromium code base


 
Project Member

Comment 1 by bugdroid1@chromium.org, Oct 24

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5efc4727bcd983d81b3ae676b184bddcaac3095b

commit 5efc4727bcd983d81b3ae676b184bddcaac3095b
Author: Dave Tapuska <dtapuska@chromium.org>
Date: Wed Oct 24 20:40:59 2018

Use TLS to stash the thread id on linux.

Appears calling the syscall over and over can be slow.

Use TLS to stash the result of the syscall.

Benchmarks:

Without change:
taskset -c 0 base_perftests --gtest_filter=SequenceManagerPerfTest.RunTenThousandImmediateTasks_OneQueue*
*RESULT task: run 10000 immediate tasks with one queue SequenceManager with message loop= 23483.009389671362 us/run
*RESULT task: run 10000 immediate tasks with one queue SequenceManager with message pump= 17142.489726027397 us/run
*RESULT task: run 10000 immediate tasks with one queue message loop= 5126.6598360655735 us/run
*RESULT task: run 10000 immediate tasks with one queue single thread in WorkerPool= 9817.776470588235 us/run

With change:
taskset -c 0 base_perftests --gtest_filter=SequenceManagerPerfTest.RunTenThousandImmediateTasks_OneQueue*
*RESULT task: run 10000 immediate tasks with one queue SequenceManager with message loop= 15673.59375 us/run
*RESULT task: run 10000 immediate tasks with one queue SequenceManager with message pump= 8832.218694885361 us/run
*RESULT task: run 10000 immediate tasks with one queue message loop= 5149.919670442842 us/run
*RESULT task: run 10000 immediate tasks with one queue single thread in WorkerPool= 9926.059523809523 us/run

BUG= 898294 

Change-Id: I414ff18fd0c92a3837b50e20165bf295b4f63082
Reviewed-on: https://chromium-review.googlesource.com/c/1291710
Reviewed-by: François Doray <fdoray@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602430}
[modify] https://crrev.com/5efc4727bcd983d81b3ae676b184bddcaac3095b/base/threading/platform_thread_posix.cc

Status: Fixed (was: Assigned)

Sign in to add a comment