Only a single thread is used for all these benchmarks; the synchronized classes are under no thread contention.
所有基准测试都只使用一个线程;同步的类不涉及线程争用。
If no thread is available, a new one is created, and then if the thread from the pool is idle for 60 seconds, it goes away.
如果没有可用的线程,则会创建一个新线程,然后如果线程池中的线程空闲了60秒,该线程就会消失。
Even better, in recent JVMs, the performance cost of uncontended synchronization (when no thread attempts to acquire a lock when another thread already holds it) is quite modest.
不过现在好了一点,在最近的JVM 中,没有争用的同步(一个线程拥有锁的时候,没有其他线程企图获得锁)的性能成本还是很低的。
Even better, in recent JVMs, the performance cost of uncontended synchronization (when no thread attempts to acquire a lock when another thread already holds it) is quite modest.
不过现在好了一点,在最近的JVM 中,没有争用的同步(一个线程拥有锁的时候,没有其他线程企图获得锁)的性能成本还是很低的。
应用推荐