自动装箱和性能 [英] autoboxing and performance

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

问题描述

我有一个应用程序,我执行数十万次计算。目前我们所有的价值都是双打。我正在使用JFormula引擎进行大部分计算,并注意到api采用了双参数,因此当我传入Double时会发生一些自动装箱。我已经阅读了一些文章,并创建了一些简单的测试,并且确实注意到了性能损失,但我仍然试图弄清楚通过我的代码并修复它所花费的时间,值得任何性能改进。我想知道是否有其他人通过使用原语获得类似和性能提升的经验?

I have an application where I perform hundreds of thousands of calculations. Currently all of our values are Doubles. I am utilizing JFormula engine for most of the calculations, and have noticed the api takes a double parameter, so there is some autoboxing taking place when I pass in a Double. I have read some articles, and created some simple tests, and do notice a performance hit, but am still trying to figure out it the time it takes to go through my code and fix this, will be worth any performance improvements. I am wondering if anyone else has had any experience with something similar and performance gains by using primitives?

推荐答案


使用自动装箱和拆箱进行科学计算或其他对性能敏感的数字代码是不合适的。
- Sun常见问题解答

这篇关于自动装箱和性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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