<commit_before>﻿using System.Collections.Immutable;
using System.Linq;

using Kirkin.Collections.Generic;

using BenchmarkDotNet.Attributes;

using Xunit;
using Xunit.Abstractions;

namespace Kirkin.Tests.Benchmarking
{
    public class BenchmarkTests
    {
        private readonly ITestOutputHelper Output;

        public BenchmarkTests(ITestOutputHelper output)
        {
            Output = output;
        }

        [Fact]
        public void Collections()
        {
            string report = Benchmarks.Run<CollectionPerf>();

            Output.WriteLine(report);
        }

        public class CollectionPerf
        {
            private int[] Integers;

            [Setup]
            public void SetUp()
            {
                Integers = new int[100000];
            }

            [Benchmark]
            public void ToArray()
            {
                Integers.ToArray();
            }

            [Benchmark]
            public void ToList()
            {
                Integers.ToList();
            }

            [Benchmark]
            public void ToImmutableArray()
            {
                Integers.ToImmutableArray();
            }

            [Benchmark]
            public void ToVector()
            {
                Integers.ToVector();
            }
        }

        [Fact]
        public void ForVsForEachOverArray()
        {
            string report = Benchmarks.Run<ForVsForEachOverArrayPerf>();

            Output.WriteLine(report);
        }

        public class ForVsForEachOverArrayPerf
        {<commit_msg>Suppress benchmarks<commit_after>﻿using System.Collections.Immutable;
using System.Linq;

using Kirkin.Collections.Generic;

using BenchmarkDotNet.Attributes;

using Xunit;
using Xunit.Abstractions;

namespace Kirkin.Tests.Benchmarking
{
    public class BenchmarkTests
    {
        private readonly ITestOutputHelper Output;

        public BenchmarkTests(ITestOutputHelper output)
        {
            Output = output;
        }

        //[Fact]
        public void Collections()
        {
            string report = Benchmarks.Run<CollectionPerf>();

            Output.WriteLine(report);
        }

        public class CollectionPerf
        {
            private int[] Integers;

            [Setup]
            public void SetUp()
            {
                Integers = new int[100000];
            }

            [Benchmark]
            public void ToArray()
            {
                Integers.ToArray();
            }

            [Benchmark]
            public void ToList()
            {
                Integers.ToList();
            }

            [Benchmark]
            public void ToImmutableArray()
            {
                Integers.ToImmutableArray();
            }

            [Benchmark]
            public void ToVector()
            {
                Integers.ToVector();
            }
        }

        //[Fact]
        public void ForVsForEachOverArray()
        {
            string report = Benchmarks.Run<ForVsForEachOverArrayPerf>();

            Output.WriteLine(report);
        }

        public class ForVsForEachOverArrayPerf
        {
{'fraction_non_alphanumeric': 0.0759493670886076, 'fraction_numerical': 0.0037974683544303796, 'mean_word_length': 1.3449554896142433, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '246465', 'n_tokens_mistral': 847, 'n_tokens_neox': 776, 'n_words': 157}