<commit_before>﻿using System;
using GeorgeCloney;
using NClone.MetadataProviders;
using NClone.ObjectReplication;

namespace NClone.Tests.Benchmarks
{
    public class ReplicatorBenchmark: BenchmarkBase
    {
        private const int iterationCount = 200000;

        private class SomeClass
        {
            public int field;
            public SomeClass2 Property { get; set; }
            //public event Action Event;
        }

        private class SomeClass2
        {
            public SomeClass3 Property { get; set; }
        }

        private class SomeClass3
        {
            public int field;
        }

        //[Benchmark]
        //public Action OneRun()
        //{
        //    var source = new SomeClass
        //                 {
        //                     field = 42,
        //                     Property = new SomeClass2 { Property = new SomeClass3 { field = 12 } }
        //                 };

        //    var replicator = new ObjectReplicator(new ConventionalMetadataProvider());
        //    replicator.Replicate("12");

        //    return () => replicator.Replicate(source);
        //}

        [Benchmark]
        public Action ManyRuns()
        {
            var source = new SomeClass
                         {
                             field = 42,
                             Property = new SomeClass2 { Property = new SomeClass3 { field = 12 } }
                         };

            var replicator = new ObjectReplicator(new ConventionalMetadataProvider());
            replicator.Replicate("12");

            return () => {
                       for (int i = 0; i < iterationCount; ++i)
                           source = replicator.Replicate(source);
                   };
        }

        [Benchmark]
        public Action ReflectionClone()
        {
            var source = new SomeClass
                         {
                             field = 42,
                             Property = new SomeClass2 { Property = new SomeClass3 { field = 12 } }
                         };

            var replicator = new ObjectReplicator(new ConventionalMetadataProvider());
            replicator.Replicate("12");
<commit_msg>Small cleanup in new benchmark<commit_after>﻿using System;
using GeorgeCloney;
using NClone.MetadataProviders;
using NClone.ObjectReplication;

namespace NClone.Tests.Benchmarks
{
    public class ReplicatorBenchmark: BenchmarkBase
    {
        private const int iterationCount = 200000;

        private class SomeClass
        {
            public int field;
            public SomeClass2 Property { get; set; }
        }

        private class SomeClass2
        {
            public SomeClass3 Property { get; set; }
        }

        private class SomeClass3
        {
            public int field;
        }

        [Benchmark]
        public Action OneRun()
        {
            var source = new SomeClass
                         {
                             field = 42,
                             Property = new SomeClass2 { Property = new SomeClass3 { field = 12 } }
                         };

            var replicator = new ObjectReplicator(new ConventionalMetadataProvider());
            replicator.Replicate("12");

            return () => replicator.Replicate(source);
        }

        [Benchmark]
        public Action ManyRuns()
        {
            var source = new SomeClass
                         {
                             field = 42,
                             Property = new SomeClass2 { Property = new SomeClass3 { field = 12 } }
                         };

            var replicator = new ObjectReplicator(new ConventionalMetadataProvider());

            return () => {
                       for (int i = 0; i < iterationCount; ++i)
                           source = replicator.Replicate(source);
                   };
        }

        [Benchmark]
        public Action ReflectionClone()
        {
            var source = new SomeClass
                         {
                             field = 42,
                             Property = new SomeClass2 { Property = new SomeClass3 { field = 12 } }
                         };

{'fraction_non_alphanumeric': 0.07507149666348904, 'fraction_numerical': 0.01572926596758818, 'mean_word_length': 1.18366285119667, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5930393', 'n_tokens_mistral': 1047, 'n_tokens_neox': 955, 'n_words': 257}