Parser optimization part1 (#1531)

* Optimize CleanTitle

* Optimize MangaEditionRegex

* Optimize special regexes

* Refactor manga|comic special parsing into simple tests

* Word bind the special regexps. Support additional "special" use cases.

* Updates to address PR comments

* CleanTitle benchmarking

* Use a smaller Comics Data set for benchmarking
This commit is contained in:
tjarls 2022-09-18 19:26:17 +01:00 committed by GitHub
parent 0403f938b0
commit 28c868b46c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 269 additions and 203 deletions

View file

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Order;
namespace API.Benchmark;
[MemoryDiagnoser]
public class CleanTitleBenchmarks
{
private static IList<string> _names;
[GlobalSetup]
public void LoadData() => _names = File.ReadAllLines("Data/Comics.txt");
[Benchmark]
public void TestCleanTitle()
{
foreach (var name in _names)
{
Services.Tasks.Scanner.Parser.Parser.CleanTitle(name, true);
}
}
}