preformance of synchronized and unsynchronized access

Mode Total time Per-operation time
CAS operation 6.6 seconds 13 nanoseconds
Synchronized method 11.8 seconds 23 nanoseconds
Unsynchronized method 3.9 seconds 7.8 nanoseconds

反射

  • field set,非反射时间基准为1
    • dalvik :反射120左右;缓存反射10左右
    • ART :反射40左右; 缓存反射12左右
    • hotshot:反射10倍左右;缓存反射2倍左右