Skip to content

perf:优化主线程判断代码#737

Merged
shifujun merged 1 commit into
Tencent:masterfrom
TestPlanB:dev2
Dec 30, 2021
Merged

perf:优化主线程判断代码#737
shifujun merged 1 commit into
Tencent:masterfrom
TestPlanB:dev2

Conversation

@TestPlanB
Copy link
Copy Markdown
Contributor

提高判断是否是主线程的执行效率,自测效益大约是每次执行减少20ms

@TestPlanB TestPlanB changed the title 提高判断效率 perf:优化主线程判断代码 Dec 30, 2021
@TestPlanB
Copy link
Copy Markdown
Contributor Author

大佬,麻烦看下这个pr噢,旧pr我关掉

@TestPlanB
Copy link
Copy Markdown
Contributor Author

== 比较对象,===比较引用,thread照理说也不可能存在同一个对象。改成===也可以

提高判断是否是主线程的执行效率,自测效益大约是每次执行减少20ms

Looper.myLooper()依赖ThreadLocal进而也依赖Thread.currentThread()。
@shifujun shifujun merged commit 7b366f5 into Tencent:master Dec 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants