Files
Umbraco-CMS/tests/Umbraco.Tests.Benchmarks/TypeFinderBenchmarks.cs
Elitsa Marinovska 9c18cd22e0 V14: Deleted code marked as obsolete for V14 (#15998)
* Obsoletions related to Delivery API

* Fix TypeLoader and TypeFinder tests

* Remove obsolete and default implementations of IFileSource and IFileTypeCollection

* More Delivery API related obsoletions

* VariationContextAccessor related

* ValueFactories obsoletion and fix references

* ValueSetBuilders obsoletions

* ValueConverters obsoletions

* Other obsolete ctors and methods

* Forgotten VariationContextAccessor obsoletion

* More obsoletions

* XPath related obsoletions

* Revert XmlHelper changes

* Delete RenamedRootNavigator and its tests

* Fix test

* XmlHelper obsoletion

* Return null instead of GetXPathValue

* Obsolete entire class instead

* Remove XPath obsoletions from IPublishedCache

* Remove XPath-related if-block that is no longer needed

* Change obsolete msg for classes needed for NuCache

* Moving classes to NuCache and making them internal

* Remove more XPath-related obsoletions

* Remove NavigableNavigator and its tests

* Cleanup

* Remove Xpath references from tests

* Revert interface deletion in MediaCache

* Using XOR operation

Co-authored-by: Nuklon <Nuklon@users.noreply.github.com>

---------

Co-authored-by: Nuklon <Nuklon@users.noreply.github.com>
2024-04-09 09:06:48 +02:00

39 lines
1.2 KiB
C#

using System.Linq;
using BenchmarkDotNet.Attributes;
using Microsoft.Extensions.Logging.Abstractions;
using Umbraco.Cms.Core.Composing;
using Umbraco.Extensions;
namespace Umbraco.Tests.Benchmarks;
[MediumRunJob]
[MemoryDiagnoser]
public class TypeFinderBenchmarks
{
private readonly TypeFinder _typeFinder1;
private readonly TypeFinder _typeFinder2;
public TypeFinderBenchmarks()
{
_typeFinder1 = new TypeFinder(new NullLogger<TypeFinder>(), new DefaultUmbracoAssemblyProvider(GetType().Assembly, NullLoggerFactory.Instance), null);
_typeFinder2 = new TypeFinder(new NullLogger<TypeFinder>(), new DefaultUmbracoAssemblyProvider(GetType().Assembly, NullLoggerFactory.Instance), null)
{
QueryWithReferencingAssemblies = false
};
}
// TODO: This setting seems to make no difference anymore
[Benchmark(Baseline = true)]
public void WithGetReferencingAssembliesCheck()
{
var found = _typeFinder1.FindClassesOfType<IDiscoverable>().Count();
}
[Benchmark]
public void WithoutGetReferencingAssembliesCheck()
{
var found = _typeFinder2.FindClassesOfType<IDiscoverable>().Count();
}
}