哪一个更有效:列表< INT>或INT [] [英] Which one is more efficient : List<int> or int[]

查看:118
本文介绍了哪一个更有效:列表< INT>或INT []的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能告诉我哪一个是之间更高效的名单,LT; INT> INT [] 。因为我工作的一个项目,正如你可能知道效率的方式如此重要的问题了。

如果您加入了一些介绍性说明到您的文章,这将会是巨大的寿:)


解决方案

 (名单应可调整大小)?清单< INT> :INT []

列表< INT> INT [] 根据需要调整大小的包装。随着JIT内联,他们应该执行的几乎的相同,但JIT将有一个更简单的时间挤掉从额外的性能 INT [] ,因为它是一个CLI原始专用IL指令。

Can someone tell me which one is more efficient between List<int> and int[]. Because I am working on a project and as you might know efficiency is way so important concern now.

If you added some introductory note to your post, it'd be great tho :)

解决方案

(list should be resizable) ? List<int> : int[]

List<int> is a wrapper for int[] that resizes as needed. With JIT inlining, they should perform almost identically, but the JIT will have an easier time edging out the extra performance from int[] because it's a CLI primitive with dedicated IL instructions.

这篇关于哪一个更有效:列表&LT; INT&GT;或INT []的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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