|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using consoletest.DataObjects;
namespace consoletest
{
public static partial class Benchmarks
{
private static void FastJson_Deserialize()
{
Console.WriteLine();
Console.Write("fastJSON 2.0.9 decode ");
FastJsonBenchmarkClass c = CreateTestedObject();
string jsonText = fastJSON.JSON.Instance.ToJSON(c);
InitTestRun();
for (int pp = 0; pp < tcount; pp++)
{
stopwatch.Reset();
stopwatch.Start();
FastJsonBenchmarkClass deserializedStore;
for (int i = 0; i < count; i++)
{
deserializedStore = (FastJsonBenchmarkClass)fastJSON.JSON.Instance.ToObject(jsonText);
}
stopwatch.Stop();
Console.Write("\t" + stopwatch.ElapsedMilliseconds);
testRunDurations.Add(stopwatch.ElapsedMilliseconds);
}
WriteAverage(true);
}
private static void FastJson_Serialize()
{
Console.WriteLine();
Console.Write("fastJSON 2.0.9 encode ");
FastJsonBenchmarkClass c = CreateTestedObject();
InitTestRun();
for (int pp = 0; pp < tcount; pp++)
{
stopwatch.Reset();
stopwatch.Start();
string jsonText = null;
for (int i = 0; i < count; i++)
{
jsonText = fastJSON.JSON.Instance.ToJSON(c);
}
stopwatch.Stop();
Console.Write("\t" + stopwatch.ElapsedMilliseconds);
testRunDurations.Add(stopwatch.ElapsedMilliseconds);
}
WriteAverage(true);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.