AtomicInteger与Integer的性能差异 [英] Performance Difference of AtomicInteger vs Integer

查看:739
本文介绍了AtomicInteger与Integer的性能差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AtomicIntegerInteger之间是否存在性能差异?

Is there any performance difference between AtomicInteger and Integer?

推荐答案

这两种类型的选择不应取决于性能. AtomicInteger的主要选择是如果您希望通过对整数进行操作来实现线程安全.

The choice of these two types should not depend on the performance. The main choice for AtomicInteger is if you want to achieve thread safety with the operations on the integer.

但是,性能差异可能很大程度上取决于所选的操作系统,因为原子操作的详细实现取决于操作系统.

However the performace difference might strongly depend on the choosen operating system, as the detailed implementation of atomic operations depend on the operating system.

这篇关于AtomicInteger与Integer的性能差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆