There is a task: measure the time for performing different operations with different collections with different data types.
Collection class code:
public class LinkedQueueLarge { LinkedList<LargeData> _LinkedList = new LinkedList<LargeData>(); public void Add(LargeData data) { _LinkedList.AddLast(data); } public LargeData Rem() { LargeData data = _LinkedList.First(); _LinkedList.RemoveFirst(); return data; } } Data for filling:
unsafe public struct LargeData { public fixed byte a[102400]; } And the code during the execution of which the error occurs:
float lql1 = 0, LinkedQueueLarge LQL = new LinkedQueueLarge(); textBox1.Text += "LinkedQueue, Large Data\n"; for (int i = 0; i < 2500; i++) { int StartTime; int ResultTime; StartTime = Environment.TickCount; LQL.Add(new LargeData()); ResultTime = Environment.TickCount - StartTime; lql1 += ResultTime; } The error itself:
System.InvalidProgramException: "The JIT compiler has detected an internal constraint."
And also in LQL._linkedList.Message (what is it all about?) In debugging when stopping due to an error value:
It is impossible to create an array of type "LargeData" from the assembly "lab07, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null" because the base type of the value is too large.
public struct LargeData { public byte[] a; }public struct LargeData { public byte[] a; }and call asLQL.Add(new LargeData { a = new byte[102400] });then there will be no such problems. - Regent