<commit_before>using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using Serilog.Events;
using Serilog.Filters.Expressions.PerformanceTests.Support;
using System;
using Xunit;

namespace Serilog.Filters.Expressions.PerformanceTests
{
    /// <summary>
    /// Tests the performance of various filtering mechanisms.
    /// </summary>
    public class ComparisonBenchmark
    {
        Func<LogEvent, bool> _trivialFilter, _handwrittenFilter, _expressionFilter;
        readonly LogEvent _event = Some.InformationEvent("{A}", 3);

        [Setup]
        public void Setup()
        {
            // Just the delegate invocation overhead
            _trivialFilter = evt => true;
<commit_msg>Moved benchmark setup to constructor<commit_after>using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using Serilog.Events;
using Serilog.Filters.Expressions.PerformanceTests.Support;
using System;
using Xunit;

namespace Serilog.Filters.Expressions.PerformanceTests
{
    /// <summary>
    /// Tests the performance of various filtering mechanisms.
    /// </summary>
    public class ComparisonBenchmark
    {
        Func<LogEvent, bool> _trivialFilter, _handwrittenFilter, _expressionFilter;
        readonly LogEvent _event = Some.InformationEvent("{A}", 3);

        public ComparisonBenchmark()
        {
            // Just the delegate invocation overhead
            _trivialFilter = evt => true;

{'fraction_non_alphanumeric': 0.08707865168539326, 'fraction_numerical': 0.0014044943820224719, 'mean_word_length': 3.305135951661631, 'pattern_counts': {'":': 0, '<': 9, '<?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': '1920356', 'n_tokens_mistral': 391, 'n_tokens_neox': 370, 'n_words': 98}