哪一个更有效:列表&LT; INT&GT;或INT [] [英] Which one is more efficient : List<int> or int[]
问题描述
有人能告诉我哪一个是之间更高效的名单,LT; INT&GT;
和 INT []
。因为我工作的一个项目,正如你可能知道效率的方式如此重要的问题了。
如果您加入了一些介绍性说明到您的文章,这将会是巨大的寿:)
(名单应可调整大小)?清单&LT; INT&GT; :INT []
列表&LT; INT&GT;
是 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屋!