<commit_before>﻿namespace SkipList.Core.Test
{
    using System;
    using System.Collections.Generic;
    using BpTree.Core;
    using NUnit.Framework;
    using SimpleSpeedTester.Core;

    [TestFixture]
    public class PerformanceTests
    {
        [Test]
        [Ignore]
        public void Performance_Add_1()
        {
#if (DEBUG)
            Console.WriteLine("Performance tests should be run only in Release mode!");
#endif
            // todo: implement performance test for multiple N
            var n = 500000;
            var items = GenerateItems(n);

            var testGroup = new TestGroup("Performance_Add_1");
            var testResultSummary = testGroup.PlanAndExecute("Performance_Add_" + n, () =>
            {
                var skipList = new SkipList<int, int>();
                for (var index = 0; index < n; index++)
                {
                    skipList[items[index]] = items[index];<commit_msg>Implements Performance_Search_1 performance test.<commit_after>﻿namespace SkipList.Core.Test
{
    using System;
    using System.Collections.Generic;
    using BpTree.Core;
    using NUnit.Framework;
    using SimpleSpeedTester.Core;

    [TestFixture]
    public class PerformanceTests
    {
        [Test]
        [Ignore]
        public void Performance_Search_1()
        {
#if (DEBUG)
            Console.WriteLine("Performance tests should be run only in Release mode!");
#endif
            // todo: implement performance test for multiple N
            var n = 500000;
            var items = GenerateItems(n);
            var rnd = new Random();

            var testGroup = new TestGroup("Performance_Search_1");

            {
                var skipList = new SkipList<int, int>();
                for (var index = 0; index < n; index++)
                {
                    skipList[items[index]] = items[index];
                }

                var testResultSummary = testGroup.PlanAndExecute("Performance_Search_" + n, () =>
                {
                    for (var i = 0; i < n; i++)
                    {
                        var value = skipList[items[rnd.Next(n)]];
                    }
                }, 5);
                Console.WriteLine(testResultSummary);
            }

            {
                var dictionary = new SortedDictionary<int, int>();
                for (var index = 0; index < n; index++)
                {
                    dictionary[items[index]] = items[index];
                }
                var clrResultSummary = testGroup.PlanAndExecute("Performance_Search_CLR" + n, () =>
                {
                    for (var i = 0; i < n; i++)
                    {
                        var value = dictionary[items[rnd.Next(n)]];
                    }
                }, 5);

                Console.WriteLine(clrResultSummary);
            }
        }

        [Test]
        [Ignore]
        public void Performance_Add_1()
        {
#if (DEBUG)
            Console.WriteLine("Performance tests should be run only in Release mode!");
#endif
            // todo: implement performance test for multiple N
            var n = 500000;
            var items = GenerateItems(n);

            var testGroup = new TestGroup("Performance_Add_1");
            var testResultSummary = testGroup.PlanAndExecute("Performance_Add_" + n, () =>
            {
                var skipList = new SkipList<int, int>();
                for (var index = 0; index < n; index++)
                {
                    skipList[items[index]] = items[index];
{'fraction_non_alphanumeric': 0.09839300817592332, 'fraction_numerical': 0.009303636876233437, 'mean_word_length': 1.510969568294409, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3006002', 'n_tokens_mistral': 947, 'n_tokens_neox': 866, 'n_words': 236}