Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 :)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
135 views
Welcome To Ask or Share your Answers For Others

1 Answer

(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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...