mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-06-18 13:04:14 -04:00
* 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
27 lines
581 B
C#
27 lines
581 B
C#
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);
|
|
}
|
|
}
|
|
}
|