Esempio n. 1
0
    static void TestStrikeV8()
    {
        var result = new Result {
            Name = "Strike.V8"
        };
        var stopwatch = Stopwatch.StartNew();

        using (var warmup = new Strike.V8.Markdownify())
        {
            warmup.Transform(testTexts.First());
        }
        stopwatch.Stop();
        result.WarmUp = stopwatch.ElapsedMilliseconds;

        stopwatch = Stopwatch.StartNew();
        using (var markdownify = new Strike.V8.Markdownify())
        {
            stopwatch.Stop();
            result.Construction = stopwatch.ElapsedMilliseconds;

            stopwatch = Stopwatch.StartNew();
            markdownify.Transform(testTexts.First());
            stopwatch.Stop();
            result.FirstRun = stopwatch.ElapsedMilliseconds;

            stopwatch = Stopwatch.StartNew();
            foreach (var text in testTexts)
            {
                markdownify.Transform(text);
            }
            stopwatch.Stop();
            result.BulkRun = stopwatch.ElapsedMilliseconds;
            result.Average = GetAverage(stopwatch.ElapsedMilliseconds);
        }
        results.Add(result);
    }
Esempio n. 2
0
    static void TestStrikeV8()
    {
        var result = new Result {Name = "Strike.V8"};
        var stopwatch = Stopwatch.StartNew();
        using (var warmup = new Strike.V8.Markdownify())
        {
            warmup.Transform(testTexts.First());
        }
        stopwatch.Stop();
        result.WarmUp = stopwatch.ElapsedMilliseconds;

        stopwatch = Stopwatch.StartNew();
        using (var markdownify = new Strike.V8.Markdownify())
        {
            stopwatch.Stop();
            result.Construction = stopwatch.ElapsedMilliseconds;

            stopwatch = Stopwatch.StartNew();
            markdownify.Transform(testTexts.First());
            stopwatch.Stop();
            result.FirstRun = stopwatch.ElapsedMilliseconds;

            stopwatch = Stopwatch.StartNew();
            foreach (var text in testTexts)
            {
                markdownify.Transform(text);
            }
            stopwatch.Stop();
            result.BulkRun = stopwatch.ElapsedMilliseconds;
            result.Average = GetAverage(stopwatch.ElapsedMilliseconds);
        }
        results.Add(result);
    }