Force app to portrait mode to prevent screen rotate and double test run.
Test run in Sumsung Galaxy Note 2
System.arraycopy is the fastest, even faster then JNI. Android have optimized the speed in dalvik VM. I am thinking of using assembly code to challenge the speed, but I do not know assembly code.
In array fill, Arrays.fill is slower then for-loop{a[i]=0} because Arrays.fill is just for-loop{a[i]=0}, and CPU is wasted in function call depth.
The fastest way to do array fill is using JNI. But I wonder if JNI call will create extra memory load.
Just wondering, Android use tons of System.arraycopy so they optimize it. But I think Array.fill is also good point to optimize.
In stackoverflow, you can find lots of ppl misunderstanding the performance without doing any benchmark.
I will try using int-array copy in the next release.
No comments:
Post a Comment