Demo: Lists and Arrays in Intermediate Language
We disassemble the benchmark DLL to show that ArrayList.Add boxes every integer, generic List.Add uses a compact three-instruction typed call, and a direct array assignment uses the IL stelem instruction with no method call overhead. The lesson demonstrates how method-call overhead and range checks account for the measurable performance gap between a list and an array.
Previous Module
A Crash Course In Intermediate Language
This Module
Basic Performance Optimizations