1.x Provide public constant instead of UnsafeAccess.isUnsafeAvailable()#3815
1.x Provide public constant instead of UnsafeAccess.isUnsafeAvailable()#3815artem-zinnatullin wants to merge 1 commit intoReactiveX:1.xfrom
Conversation
|
I guess this single line should be inlined by JIT. Are you worrying about some old Android versions without JIT? |
|
RxJava doesn't support Android devices which lacked a JIT because they only On Thu, Mar 31, 2016 at 3:14 PM Shixiong Zhu notifications@github.com
|
|
Yes, Regarding Android afaik: from Android 2.3 to 4.4 it has Dalvik VM that has JIT, from Android 5 to 6 it has ART without JIT, upcoming Android N release will have ART with JIT. Idea is: if we can do something a little bit more efficiently and it doesn't make code much worse, why not. |
6a725e4 to
d98f77c
Compare
|
I don't know. |
|
Totally up to you, it's nanooptimization in // -1 method for Android BTW haha |
|
I think the reason for this should be that it's just a bit cleaner, inlined, and one less method. Perf isn't really a good or measurable heuristic for this. Maybe there's an argument for keeping the method for testing purposes, but I doubt people are mocking this. |
|
We have trouble with Samsung devices again. Could you include a check for a system property named |
|
@akarnokd to not mix refactoring with new logic I've opened separate PR for system property #3829. Feel free to merge in any order. @hzsweers at the moment I don't see any profit in using method, and I'm not sure that somebody is mocking static method (PowerMock?), if I'll need it I'll rewrite value of |
|
Was just chiming in, I doubt anyone us mocking it and it is cleaner so I say go for it. |
|
In term of performance, I don't think the impact will be measurable (even in interpreted mode), the method will be under the default threshold for Trivial Method (=6 for Hotspot), and will be inlined as soon as the caller is compiled, reference code in OpenJDK. The only remaining question is, what is cleaner: |
|
As we may add other logic into |
|
I'd keep this as a method as well. |
|
ok |
Motivation: save some nanoseconds on JVM and a little bit more on Android, new construction will also be easier for JIT.