public void TestReallyBigString() { Stopwatch s = Stopwatch.StartNew(); ComplexTree <object> mt = JSONParser.CalculateComplexity(longlongstring); JSONParseThread.s = longlongstring; JSONParseThread.ParseThread(mt[0]); JSONNode n = mt[0].node; //Task t = Task.Factory.StartNew(() => { JSONNode n = JSONParseThread.ParseThread(mt[0], longlongstring); }); //t.Wait(); s.Stop(); Console.WriteLine(s.Elapsed); Console.WriteLine(mt[0][0].Count); /* * Task t = Task.Factory.StartNew(()=>JSONParser.ParseStart((JSONNode n) => * { * s.Stop(); * Console.WriteLine(s.ElapsedTicks); * File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + "testout.txt", s.ElapsedTicks + ""); * return null; * }, longlongstring)); * t.Wait(); */ Console.WriteLine("test function finished"); }
static public object ParseByMultiThread(string s) { ComplexTree <object> mt = JSONParser.CalculateComplexity(s); JSONParseThread.s = s; //JSONNode n = JSONParseThread.Parse(mt[0]); JSONParseThread.ParseThread(mt[0]); //Console.WriteLine(mt[0].StartPoint + " " + mt[0].EndPoint + " " + mt[0].Count); JSONNode n = mt[0].node; return(n); }