Пример #1
0
        private void Benchmark(Func <string, SRegex> compile)
        {
            SRegex sre    = null;
            bool   result = false;

            CompileTimeTicks         = Bench.Measure(() => { sre = compile(SrePattern); }, CompilationSampleCount);
            ExecutionTimeTicks       = Bench.Measure(() => result = sre.Match(TestInput), ExecutionSampleCount);
            ExecPreparationTimeTicks = Bench.Measure(() => TestInput.Select(ch => (int)ch).ToArray(), ExecutionSampleCount);
            if (!result)
            {
                throw new InvalidOperationException("Internal test error");
            }
        }
Пример #2
0
        private bool Match(string pattern, string input)
        {
            SRegex sre = MakeSRegex(pattern);

            return(sre.Match(input));
        }