您的位置:首页 > 编程语言 > Java开发

java三种实例对象方式性能比拼

2010-07-20 16:05 302 查看
测试单位:毫微秒

测试次数:5

第一种:普通的new对象

第二种:用获取到的Class对象调用newInstance()方法

第三种:用获取到类中的Constructor对象调用newInstance()方法

new
cost time:15029843
cost time:9462656
cost time:9229386
cost time:9313753
cost time:9725817

Class.newInstance
cost time:1114809564
cost time:1083132353
cost time:1078971210
cost time:1097584191
cost time:1088212608

Constructor.newInstance
cost time:1021233983
cost time:995615364
cost time:992249853
cost time:1005193956
cost time:1015676294
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: