据我的粗略测量,在双处理器 Linux 系统上的 Sun 1.3 JDK 中进行 ThreadLocal.get() 操作,所耗费的时间大约是无争用同步的两倍。
My rough benchmarks running the Sun 1.3 JDK on a two-processor Linux system show that a ThreadLocal.get() operation takes about twice as long as an uncontended synchronization.
两猫逮一鼠,二妇侍一夫,双狗争一骨,永远难和睦。
Two cats and a mouse, two wives in one house, two dogs and a bone, never agree in one.
应用推荐