public static long Onewaychainlist_Test(int arysize, int appendtimes, int deletimes, int inserttimes, int findtimes) { long t1; var testary = AryDeal.intBuild(0, arysize); t1 = TickCount.GetTickCount(); CSolution.Create_List(testary, testary.Length); for (var i = 0; i < appendtimes; ++i) { CSolution.List_Append(i); } for (var i = 0; i < deletimes; ++i) { CSolution.List_Delete(i); } for (var i = 0; i < inserttimes; ++i) { CSolution.List_Insert(i, i); } for (var i = 0; i < findtimes; ++i) { CSolution.List_Search(i); } CSolution.List_Clean(); return(TickCount.GetTickCount() - t1); }
private void label37_Click(object sender, EventArgs e) { Form1.Turbo(); long tt; int[] ary = AryDeal.intBuild(0, 500); tt = CSolution.SuperPi(ary, ary.Length); label45.Text = tt.ToString(); }
private void label22_Click(object sender, EventArgs e) { Form1.Turbo(); long tt; int a = int.Parse(textBox25.Text); int[] ary1 = AryDeal.intBuild(1, a); tt = TickCount.GetTickCount(); CSolution.Insert_Sort(ary1, ary1.Length); tt = TickCount.GetTickCount() - tt; label54.Text = tt.ToString(); }
public static void IntMax() { int m = 300, n = 300, p = 300; var ary2 = AryDeal.intBuild(0, m * n); var ary3 = AryDeal.intBuild(0, n * p); var ary4 = new int[m * p]; long t1 = 0; for (var i = 0; i < 120; i++) { t1 += CSolution.Int_MatrixMulti(ary2, m, n, ary3, p, ary4); } ValueIn(t1); }
private void label38_Click(object sender, EventArgs e) { Form1.Turbo(); long tt; int a = int.Parse(textBox16.Text); int[] ary1 = AryDeal.intBuild(0, a * a); int[] ary2 = AryDeal.intBuild(0, a * a); int[] ary3 = new int[a * a]; for (int i = 0; i < a * a; ++i) { ary3[i] = 0; } tt = CSolution.Int_MatrixMulti(ary1, a, a, ary2, a, ary3); label47.Text = tt.ToString(); }
public static long Btree_Test() { long t1; var testAry = AryDeal.intBuild(0, 30000); t1 = TickCount.GetTickCount(); CSolution.Btree_Create(testAry, testAry.Length); for (var i = 0; i < 30000; ++i) { CSolution.Btree_Insert(10000 - i); CSolution.Btree_Find(i); CSolution.Btree_Delete(i); } var rltAry = new int[CSolution.Btree_Count()]; CSolution.Btree_Print(rltAry); CSolution.Btree_Clean(); return(TickCount.GetTickCount() - t1); }
public static long Onewaychainlist_Test() { long t1; var testary = AryDeal.intBuild(0, 10000); t1 = TickCount.GetTickCount(); CSolution.Create_List(testary, testary.Length); for (var i = 0; i < 10000; ++i) { CSolution.List_Append(i); CSolution.List_Search(i); CSolution.List_Delete(i); CSolution.List_Insert(i, i); } var rltary = new int[CSolution.List_Count()]; CSolution.List_Print(rltary, rltary.Length); CSolution.List_Clean(); return(TickCount.GetTickCount() - t1); }
public static long Twowaychainlist_Test(int arySize, int headdeTimes, int headinTimes, int appendTimes, int taildeTimes, int findTimes, int inTimes, int deTimes) { long ticks; var ary1 = AryDeal.intBuild(0, arySize); ticks = TickCount.GetTickCount(); CSolution.TwowayList_Create(ary1, ary1.Length); for (var i = 0; i < headdeTimes; ++i) { CSolution.TwowayList_Headin(i); } for (var i = 0; i < headinTimes; ++i) { CSolution.TwowayList_Headde(); } for (var i = 0; i < appendTimes; ++i) { CSolution.TwowayList_Append(i); } for (var i = 0; i < taildeTimes; ++i) { CSolution.TwowayList_Tailde(); } for (var i = 0; i < findTimes; ++i) { CSolution.TwowayList_Search(i); } for (var i = 0; i < inTimes; ++i) { CSolution.TwowayList_Insert(i, i); } for (var i = 0; i < deTimes; ++i) { CSolution.TwowayList_Dele(i); } CSolution.TwowayList_Clean(); return(TickCount.GetTickCount() - ticks); }
public static long Twowaychainlist_Test() { long t1; var ary1 = AryDeal.intBuild(0, 20000); t1 = TickCount.GetTickCount(); CSolution.TwowayList_Create(ary1, ary1.Length); for (var i = 0; i < 20000; ++i) { CSolution.TwowayList_Headin(i); CSolution.TwowayList_Headde(); CSolution.TwowayList_Append(i); CSolution.TwowayList_Tailde(); CSolution.TwowayList_Search(i); CSolution.TwowayList_Dele(i); } var rltary = new int[CSolution.TwowayList_Count()]; CSolution.TwowayList_Print(rltary); CSolution.TwowayList_Clean(); return(TickCount.GetTickCount() - t1); }
public static long Btree_Test(int arysize, int inserttimes, int findtimes, int deletimes) { long t1; var testAry = AryDeal.intBuild(0, arysize); t1 = TickCount.GetTickCount(); CSolution.Btree_Create(testAry, testAry.Length); for (var i = 0; i < inserttimes; ++i) { CSolution.Btree_Insert(inserttimes - i); } for (var i = 0; i < findtimes; ++i) { CSolution.Btree_Find(i); } for (var i = 0; i < deletimes; ++i) { CSolution.Btree_Delete(i); } CSolution.Btree_Clean(); return(TickCount.GetTickCount() - t1); }
/*------------------------测试----------------------- */ public void Single_ThreadTest()//单线程主函数 { testResult = new UIdelegete(SinThreadTestResultFlash); var freqRecord = new Queue <int>(); ThreadControl.MyProcessHigh(); long gg, t1;//时间记录 int x1; Form1.Turbo();//提高cpu频率 //栈操作,38mb考验内存和前端总线 gg = Ctest.Stack_Test(); resultRecord.Enqueue(gg); //树操作,117kb gg = Ctest.Btree_Test(); resultRecord.Enqueue(gg); //pi,39kb var ary = new int[10000]; gg = CSolution.SuperPi(ary, 10000); ary = null; resultRecord.Enqueue(gg); //随机整数 CSolution.Int_Test(1, out x1); resultRecord.Enqueue(x1); freqRecord.Enqueue(crtFreq); //归并排序+二分查找,38mb var ary1 = AryDeal.intBuild(1, 10000000); t1 = TickCount.GetTickCount(); CSolution.Merge_Sort(ary1, ary1.Length); for (var i = 0; i < 100000; ++i) { CSolution.Mid_Search(ary1, ary1.Length, i); } t1 = TickCount.GetTickCount() - t1; ary1 = null; resultRecord.Enqueue(t1); freqRecord.Enqueue(crtFreq); //泰勒多项式 gg = CSolution.TalorSeries_Test(100); resultRecord.Enqueue(gg); freqRecord.Enqueue(crtFreq); //随机浮点 CSolution.Float_Test(3, out x1); resultRecord.Enqueue(x1); freqRecord.Enqueue(crtFreq); //双向链表,78kb gg = Ctest.Twowaychainlist_Test(); resultRecord.Enqueue(gg); freqRecord.Enqueue(crtFreq); //单向链表,39kb gg = Ctest.Onewaychainlist_Test(); resultRecord.Enqueue(gg); freqRecord.Enqueue(crtFreq); //队列,156kb gg = 0; for (var i = 0; i < 101; ++i) { gg += Ctest.Queue_Test(); } resultRecord.Enqueue(gg); freqRecord.Enqueue(crtFreq); //光照渲染器,2-3mb左右 gg = CSolution.renderTest(1); resultRecord.Enqueue(gg); freqRecord.Enqueue(crtFreq); //2d图像缩放,1kb gg = CSolution.imageDeal(1, 1); resultRecord.Enqueue(gg); freqRecord.Enqueue(crtFreq); //矩阵整数,1mb int m = 300, n = 300, p = 300; var ary2 = AryDeal.intBuild(0, m * n); var ary3 = AryDeal.intBuild(0, n * p); var ary4 = new int[m * p]; gg = 0; for (var i = 0; i < 30; i++) { gg += CSolution.Int_MatrixMulti(ary2, m, n, ary3, p, ary4); } ary2 = null; ary3 = null; ary4 = null; resultRecord.Enqueue(gg); freqRecord.Enqueue(crtFreq); //浮点矩阵 var ary5 = AryDeal.floatBuild(0, m * n); var ary6 = AryDeal.floatBuild(0, n * p); var ary7 = new double[m * p]; gg = 0; for (var i = 0; i < 30; i++) { gg += CSolution.Double_MatrixMulti(ary5, m, n, ary6, p, ary7); } resultRecord.Enqueue(gg); ary5 = null; ary6 = null; ary7 = null; freqRecord.Enqueue(crtFreq); gg = 0; t1 = freqRecord.Count; for (var i = 0; i < t1; ++i) { gg += freqRecord.Dequeue(); } resultRecord.Enqueue(gg / t1); this.Invoke(testResult); }