public void ComplexityTimeConsumeTest() { Stopwatch s = new Stopwatch(); s.Start(); JSONParseThread.Initialize(); ComplexTree <object> t = JSONParser.CalculateComplexity(longlongstring); s.Stop(); Console.WriteLine(s.Elapsed); Console.WriteLine(t[0].Count); }
public void TestBigStringSingleThread() { Stopwatch s = Stopwatch.StartNew(); JSONParseThread.Initialize(); ComplexTree <object> mt = JSONParser.CalculateComplexity(longlongstring); JSONParseThread.s = longlongstring; JSONNode n = JSONParseThread.Parse(mt[0]); s.Stop(); Console.WriteLine(s.Elapsed); Console.WriteLine(n[0][0].value); }
public void SetUp() { //longlongstring = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "hugefile2.json"); //longlongstring = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "ReallyBigJSON.json"); longlongstring = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "FakeJSON.json"); ThreadPool.SetMaxThreads(65536, 65535); //ThreadPool.SetMinThreads(2000, 2000); if (!JSONParseThread.Initialized) { JSONParseThread.Initialize(); } }
static void Main(string[] args) { JSONParseThread.Initialize(); j = new JsonParser(); /* * FileStream ostrm; * StreamWriter writer; * TextWriter oldOut = Console.Out; * try * { * ostrm = new FileStream("./Redirect20.txt", FileMode.OpenOrCreate, FileAccess.Write); * writer = new StreamWriter(ostrm); * } * catch (Exception e) * { * Console.WriteLine("Cannot open Redirect.txt for writing"); * Console.WriteLine(e.Message); * return; * } * Console.SetOut(writer); */ ParseTest10MB(); GC.Collect(); Console.WriteLine("finished 10MB"); ParseTest1MB(); GC.Collect(); Console.WriteLine("finished 1MB"); ParseTest10KB1000(); GC.Collect(); Console.WriteLine("finished 10kb 1000times"); ParseTest100Byte100000(); Console.WriteLine("finished 100byte 100,000times"); GC.Collect(); //Console.SetOut(oldOut); //writer.Close(); //ostrm.Close(); //string end = Console.ReadLine(); }