Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Dec 30, 2021
Merged

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

merged 1 commit into from
Dec 30, 2021

Conversation

TestPlanB
Copy link
Contributor

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

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

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

@TestPlanB
Copy link
Contributor Author

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

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

Looper.myLooper()依赖ThreadLocal进而也依赖Thread.currentThread()。
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