I tested a short test on an array instance using the syntax you are describing, and found that creating instances with values ββother than the defaults decreased about 2.2 times longer than the instantaneous value with the defaults.
It takes about the same amount of time to switch and create instances with default values.
In fact, when I looked at decompilation, it seems that what happens is that the array is initialized and then filled with any values ββthat are not standard.
Creating instances with non-standard values:
bool[] abPrimes = new[] { true, true }; 0000007e mov edx,2 00000083 mov ecx,79114A46h 00000088 call FD3006F0 0000008d mov dword ptr [ebp-64h],eax 00000090 mov eax,dword ptr [ebp-64h] 00000093 mov dword ptr [ebp-54h],eax 00000096 mov eax,dword ptr [ebp-54h] 00000099 cmp dword ptr [eax+4],0 0000009d ja 000000A4 0000009f call 76A9A8DC 000000a4 mov byte ptr [eax+8],1 000000a8 mov eax,dword ptr [ebp-54h] 000000ab cmp dword ptr [eax+4],1 000000af ja 000000B6 000000b1 call 76A9A8DC 000000b6 mov byte ptr [eax+9],1 000000ba mov eax,dword ptr [ebp-54h] 000000bd mov dword ptr [ebp-40h],eax
Creating instances with default values:
bool[] abPrimes2 = new[] { false, false }; 000000c0 mov edx,2 000000c5 mov ecx,79114A46h 000000ca call FD3006F0 000000cf mov dword ptr [ebp-68h],eax 000000d2 mov eax,dword ptr [ebp-68h] 000000d5 mov dword ptr [ebp-54h],eax 000000d8 mov eax,dword ptr [ebp-54h] 000000db mov dword ptr [ebp-5Ch],eax
patjbs
source share