From 6b1ed89cb0255ae4a6bc89314d8b8c68c7564779 Mon Sep 17 00:00:00 2001 From: Stephan Date: Tue, 27 Mar 2018 16:42:52 +0200 Subject: [PATCH] Port v7@2aa0dfb2c5 - WIP --- .../BulkInsertBenchmarks.cs | 24 +-- .../ConcurrentDictionaryBenchmarks.cs | 153 ++++++++++++++++++ .../Config/QuickRunConfigAttribute.cs | 33 ++++ ...ckRunWithMemoryDiagnoserConfigAttribute.cs | 20 +++ .../LinqCastBenchmarks.cs | 10 +- .../ModelToSqlExpressionHelperBenchmarks.cs | 14 +- src/Umbraco.Tests.Benchmarks/Program.cs | 14 +- .../StringReplaceManyBenchmarks.cs | 138 ++++++++++++++++ .../TryConvertToBenchmarks.cs | 44 +++++ .../Umbraco.Tests.Benchmarks.csproj | 63 ++++---- src/Umbraco.Tests.Benchmarks/XmlBenchmarks.cs | 25 +-- .../XmlPublishedContentInitBenchmarks.cs | 18 +-- src/Umbraco.Tests.Benchmarks/packages.config | 99 ++++++------ 13 files changed, 487 insertions(+), 168 deletions(-) create mode 100644 src/Umbraco.Tests.Benchmarks/ConcurrentDictionaryBenchmarks.cs create mode 100644 src/Umbraco.Tests.Benchmarks/Config/QuickRunConfigAttribute.cs create mode 100644 src/Umbraco.Tests.Benchmarks/Config/QuickRunWithMemoryDiagnoserConfigAttribute.cs create mode 100644 src/Umbraco.Tests.Benchmarks/StringReplaceManyBenchmarks.cs create mode 100644 src/Umbraco.Tests.Benchmarks/TryConvertToBenchmarks.cs diff --git a/src/Umbraco.Tests.Benchmarks/BulkInsertBenchmarks.cs b/src/Umbraco.Tests.Benchmarks/BulkInsertBenchmarks.cs index 62c837ec23..0505974304 100644 --- a/src/Umbraco.Tests.Benchmarks/BulkInsertBenchmarks.cs +++ b/src/Umbraco.Tests.Benchmarks/BulkInsertBenchmarks.cs @@ -17,31 +17,15 @@ using Umbraco.Core.Persistence.Mappers; using Umbraco.Core.Persistence.Querying; using Umbraco.Core.Persistence.SqlSyntax; using Umbraco.Core.Scoping; +using Umbraco.Tests.Benchmarks.Config; using Umbraco.Tests.TestHelpers; using ILogger = Umbraco.Core.Logging.ILogger; namespace Umbraco.Tests.Benchmarks { - [Config(typeof(Config))] + [QuickRunWithMemoryDiagnoserConfig] public class BulkInsertBenchmarks { - private class Config : ManualConfig - { - public Config() - { - Add(new MemoryDiagnoser()); - //Add(ExecutionValidator.FailOnError); - - //The 'quick and dirty' settings, so it runs a little quicker - // see benchmarkdotnet FAQ - Add(Job.Default - .WithLaunchCount(1) // benchmark process will be launched only once - .WithIterationTime(TimeInterval.FromMilliseconds(100)) // 100ms per iteration - .WithWarmupCount(3) // 3 warmup iteration - .WithTargetCount(3)); // 3 target iteration - } - } - private static byte[] _initDbBytes; // fixme - should run on LocalDb same as NPoco tests! @@ -71,7 +55,7 @@ namespace Umbraco.Tests.Benchmarks return f.CreateDatabase(); } - [Setup] + [GlobalSetup] public void Setup() { var logger = new DebugDiagnosticsLogger(); @@ -158,7 +142,7 @@ namespace Umbraco.Tests.Benchmarks return data; } - [Cleanup] + [GlobalCleanup] public void Cleanup() { _dbSqlCe.Dispose(); diff --git a/src/Umbraco.Tests.Benchmarks/ConcurrentDictionaryBenchmarks.cs b/src/Umbraco.Tests.Benchmarks/ConcurrentDictionaryBenchmarks.cs new file mode 100644 index 0000000000..4e8476bb6d --- /dev/null +++ b/src/Umbraco.Tests.Benchmarks/ConcurrentDictionaryBenchmarks.cs @@ -0,0 +1,153 @@ +using BenchmarkDotNet.Attributes; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Umbraco.Core.Collections; + +namespace Umbraco.Tests.Benchmarks +{ + [MemoryDiagnoser] + public class ConcurrentDictionaryBenchmarks + { + private static readonly ConcurrentDictionary AssignableTypeCache = new ConcurrentDictionary(); + + private static object input = new Bar(); + + private static Type source = typeof(Bar); + + private static Type target = typeof(Foo); + + [Benchmark(Baseline = true)] + public bool GetCachedCanAssignFactory() + { + return AssignableTypeCache.GetOrAdd(new CompositeTypeTypeKey(source, target), k => + { + var ksource = k.Type1; + var ktarget = k.Type2; + + return ktarget.IsAssignableFrom(ksource) && typeof(IConvertible).IsAssignableFrom(ksource); + }); + } + + [Benchmark] + public bool GetCachedCanAssignNoFactory() + { + // This method is 10% faster + var key = new CompositeTypeTypeKey(source, target); + bool canConvert; + if (AssignableTypeCache.TryGetValue(key, out canConvert)) + { + return canConvert; + } + + // "is" is faster than "IsAssignableFrom" + if (input is IConvertible && target.IsAssignableFrom(source)) + { + return AssignableTypeCache[key] = true; + } + + return AssignableTypeCache[key] = false; + } + + private class Foo : IConvertible + { + public TypeCode GetTypeCode() + { + return TypeCode.Object; + } + + public bool ToBoolean(IFormatProvider provider) + { + throw new NotImplementedException(); + } + + public byte ToByte(IFormatProvider provider) + { + throw new NotImplementedException(); + } + + public char ToChar(IFormatProvider provider) + { + throw new NotImplementedException(); + } + + public DateTime ToDateTime(IFormatProvider provider) + { + throw new NotImplementedException(); + } + + public decimal ToDecimal(IFormatProvider provider) + { + throw new NotImplementedException(); + } + + public double ToDouble(IFormatProvider provider) + { + throw new NotImplementedException(); + } + + public short ToInt16(IFormatProvider provider) + { + throw new NotImplementedException(); + } + + public int ToInt32(IFormatProvider provider) + { + throw new NotImplementedException(); + } + + public long ToInt64(IFormatProvider provider) + { + throw new NotImplementedException(); + } + + public sbyte ToSByte(IFormatProvider provider) + { + throw new NotImplementedException(); + } + + public float ToSingle(IFormatProvider provider) + { + throw new NotImplementedException(); + } + + public string ToString(IFormatProvider provider) + { + throw new NotImplementedException(); + } + + public object ToType(Type conversionType, IFormatProvider provider) + { + if (conversionType == typeof(Foo)) + { + return new Foo(); + } + + throw new NotImplementedException(); + } + + public ushort ToUInt16(IFormatProvider provider) + { + throw new NotImplementedException(); + } + + public uint ToUInt32(IFormatProvider provider) + { + throw new NotImplementedException(); + } + + public ulong ToUInt64(IFormatProvider provider) + { + throw new NotImplementedException(); + } + } + + private class Bar : Foo + { + + } + } +} diff --git a/src/Umbraco.Tests.Benchmarks/Config/QuickRunConfigAttribute.cs b/src/Umbraco.Tests.Benchmarks/Config/QuickRunConfigAttribute.cs new file mode 100644 index 0000000000..f7d6b6bb72 --- /dev/null +++ b/src/Umbraco.Tests.Benchmarks/Config/QuickRunConfigAttribute.cs @@ -0,0 +1,33 @@ +using BenchmarkDotNet.Configs; +using BenchmarkDotNet.Horology; +using BenchmarkDotNet.Jobs; +using System; + +namespace Umbraco.Tests.Benchmarks.Config +{ + /// + /// Configures the benchmark to run with less warmup and a shorter iteration time than the standard benchmark. + /// + public class QuickRunConfigAttribute : Attribute, IConfigSource + { + /// + /// Initializes a new instance of the class. + /// + public QuickRunConfigAttribute() + { + Config = (ManualConfig) ManualConfig.CreateEmpty() + .With(Job.Default.WithLaunchCount(1) // benchmark process will be launched only once + .WithIterationTime(new TimeInterval(100, TimeUnit.Millisecond)) // 100ms per iteration + .WithWarmupCount(3) // 3 warmup iteration + .WithTargetCount(3)); // 3 target iteration + } + + /// + /// Gets the manual configuration. + /// + protected ManualConfig Config { get; } + + /// + IConfig IConfigSource.Config => Config; + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests.Benchmarks/Config/QuickRunWithMemoryDiagnoserConfigAttribute.cs b/src/Umbraco.Tests.Benchmarks/Config/QuickRunWithMemoryDiagnoserConfigAttribute.cs new file mode 100644 index 0000000000..381efc9139 --- /dev/null +++ b/src/Umbraco.Tests.Benchmarks/Config/QuickRunWithMemoryDiagnoserConfigAttribute.cs @@ -0,0 +1,20 @@ +using BenchmarkDotNet.Configs; +using BenchmarkDotNet.Diagnosers; + +namespace Umbraco.Tests.Benchmarks.Config +{ + /// + /// Configures the benchmark to run with less warmup and a shorter iteration time than the standard benchmark, + /// and include memory usage diagnosis. + /// + public class QuickRunWithMemoryDiagnoserConfigAttribute : QuickRunConfigAttribute + { + /// + /// Initializes a new instance of the class. + /// + public QuickRunWithMemoryDiagnoserConfigAttribute() + { + Config.Add(new MemoryDiagnoser()); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests.Benchmarks/LinqCastBenchmarks.cs b/src/Umbraco.Tests.Benchmarks/LinqCastBenchmarks.cs index 50ae745237..824b1beed0 100644 --- a/src/Umbraco.Tests.Benchmarks/LinqCastBenchmarks.cs +++ b/src/Umbraco.Tests.Benchmarks/LinqCastBenchmarks.cs @@ -9,17 +9,9 @@ namespace Umbraco.Tests.Benchmarks /// /// Want to check what is faster OfType or Cast when a enurable all has the same items /// - [Config(typeof(Config))] + [MemoryDiagnoser] public class LinqCastBenchmarks { - private class Config : ManualConfig - { - public Config() - { - Add(new MemoryDiagnoser()); - } - } - public LinqCastBenchmarks() { _array = new List(); diff --git a/src/Umbraco.Tests.Benchmarks/ModelToSqlExpressionHelperBenchmarks.cs b/src/Umbraco.Tests.Benchmarks/ModelToSqlExpressionHelperBenchmarks.cs index e029eea473..3532eba6b2 100644 --- a/src/Umbraco.Tests.Benchmarks/ModelToSqlExpressionHelperBenchmarks.cs +++ b/src/Umbraco.Tests.Benchmarks/ModelToSqlExpressionHelperBenchmarks.cs @@ -1,7 +1,6 @@ using System; using System.Linq.Expressions; using BenchmarkDotNet.Attributes; -using BenchmarkDotNet.Configs; using BenchmarkDotNet.Diagnosers; using Moq; using Umbraco.Core.Models; @@ -11,17 +10,9 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Tests.Benchmarks { - [Config(typeof(Config))] + [MemoryDiagnoser] public class ModelToSqlExpressionHelperBenchmarks { - private class Config : ManualConfig - { - public Config() - { - Add(new MemoryDiagnoser()); - } - } - public ModelToSqlExpressionHelperBenchmarks() { var contentMapper = new ContentMapper(); @@ -41,7 +32,7 @@ namespace Umbraco.Tests.Benchmarks for (int i = 0; i < 100; i++) { var a = i; - var b = i*10; + var b = i * 10; Expression> predicate = content => content.Path.StartsWith("-1") && content.Published && (content.ContentTypeId == a || content.ContentTypeId == b); @@ -68,6 +59,5 @@ namespace Umbraco.Tests.Benchmarks var result = modelToSqlExpressionHelper.Visit(_cachedExpression); } } - } } diff --git a/src/Umbraco.Tests.Benchmarks/Program.cs b/src/Umbraco.Tests.Benchmarks/Program.cs index 9687225a46..c9332e7fa3 100644 --- a/src/Umbraco.Tests.Benchmarks/Program.cs +++ b/src/Umbraco.Tests.Benchmarks/Program.cs @@ -6,19 +6,7 @@ namespace Umbraco.Tests.Benchmarks { public static void Main(string[] args) { - var switcher = new BenchmarkSwitcher(new[] - { - typeof(BulkInsertBenchmarks), - typeof(ModelToSqlExpressionHelperBenchmarks), - typeof(XmlBenchmarks), - typeof(LinqCastBenchmarks), - //typeof(DeepCloneBenchmarks), - typeof(XmlPublishedContentInitBenchmarks), - typeof(CtorInvokeBenchmarks), - typeof(SqlTemplatesBenchmark), - - }); - switcher.Run(args); + new BenchmarkSwitcher(typeof(Program).Assembly).Run(args); } } } diff --git a/src/Umbraco.Tests.Benchmarks/StringReplaceManyBenchmarks.cs b/src/Umbraco.Tests.Benchmarks/StringReplaceManyBenchmarks.cs new file mode 100644 index 0000000000..796fe4f4b6 --- /dev/null +++ b/src/Umbraco.Tests.Benchmarks/StringReplaceManyBenchmarks.cs @@ -0,0 +1,138 @@ +using BenchmarkDotNet.Attributes; +using System; +using System.Collections.Generic; +using System.Linq; +using Umbraco.Tests.Benchmarks.Config; + +namespace Umbraco.Tests.Benchmarks +{ + [QuickRunWithMemoryDiagnoserConfig] + public class StringReplaceManyBenchmarks + { + /* + + short text, short replacement: + + Method | Mean | Error | StdDev | Scaled | ScaledSD | Gen 0 | Allocated | + --------------------------------------------- |---------:|----------:|----------:|-------:|---------:|-------:|----------:| + 'String.ReplaceMany w/chars - Aggregate' | 236.0 ns | 40.92 ns | 2.312 ns | 1.00 | 0.00 | 0.0461 | 200 B | + 'String.ReplaceMany w/chars - For Loop' | 166.7 ns | 70.51 ns | 3.984 ns | 0.71 | 0.01 | 0.0420 | 180 B | + 'String.ReplaceMany w/dictionary - Aggregate' | 606.5 ns | 342.94 ns | 19.377 ns | 2.57 | 0.07 | 0.0473 | 212 B | + 'String.ReplaceMany w/dictionary - For Each' | 571.8 ns | 232.33 ns | 13.127 ns | 2.42 | 0.05 | 0.0458 | 212 B | + + long text, short replacement: + + Method | Mean | Error | StdDev | Scaled | ScaledSD | Gen 0 | Allocated | + --------------------------------------------- |----------:|----------:|----------:|-------:|---------:|-------:|----------:| + 'String.ReplaceMany w/chars - Aggregate' | 5.771 us | 9.963 us | 0.5630 us | 1.00 | 0.00 | 1.6798 | 6.94 KB | + 'String.ReplaceMany w/chars - For Loop' | 4.962 us | 2.121 us | 0.1199 us | 0.87 | 0.08 | 1.6840 | 6.92 KB | + 'String.ReplaceMany w/dictionary - Aggregate' | 14.514 us | 8.189 us | 0.4627 us | 2.53 | 0.22 | 1.6447 | 6.96 KB | + 'String.ReplaceMany w/dictionary - For Each' | 15.445 us | 24.745 us | 1.3981 us | 2.69 | 0.30 | 1.5696 | 6.96 KB | + + short text, long replacements dictionary: + + Method | Mean | Error | StdDev | Scaled | ScaledSD | Gen 0 | Allocated | + --------------------------------------------- |-----------:|-----------:|----------:|-------:|---------:|-------:|----------:| + 'String.ReplaceMany w/chars - Aggregate' | 257.0 ns | 200.0 ns | 11.30 ns | 1.00 | 0.00 | 0.0452 | 200 B | + 'String.ReplaceMany w/chars - For Loop' | 182.4 ns | 221.0 ns | 12.49 ns | 0.71 | 0.05 | 0.0425 | 180 B | + 'String.ReplaceMany w/dictionary - Aggregate' | 7,273.8 ns | 2,747.1 ns | 155.22 ns | 28.34 | 1.12 | 0.0714 | 464 B | + 'String.ReplaceMany w/dictionary - For Each' | 6,981.0 ns | 5,500.7 ns | 310.80 ns | 27.20 | 1.38 | 0.0775 | 464 B | + + long text, long replacements dictionary: + + Method | Mean | Error | StdDev | Scaled | ScaledSD | Gen 0 | Allocated | + --------------------------------------------- |-----------:|-----------:|-----------:|-------:|---------:|-------:|----------:| + 'String.ReplaceMany w/chars - Aggregate' | 4.868 us | 3.420 us | 0.1932 us | 1.00 | 0.00 | 1.6816 | 6.94 KB | + 'String.ReplaceMany w/chars - For Loop' | 4.958 us | 2.633 us | 0.1487 us | 1.02 | 0.04 | 1.6791 | 6.92 KB | + 'String.ReplaceMany w/dictionary - Aggregate' | 181.309 us | 210.177 us | 11.8754 us | 37.29 | 2.32 | 5.3571 | 24.28 KB | + 'String.ReplaceMany w/dictionary - For Each' | 174.567 us | 113.733 us | 6.4262 us | 35.90 | 1.57 | 5.8594 | 24.28 KB | + + */ + + // don't use constants + // ReSharper disable ConvertToConstant.Local + + // input text for ReplaceMany + private static readonly string Text; + + // replaced chars for ReplaceMany with chars + private static readonly char[] ReplacedChars = { ',', '.', ':', '&', '#' }; + + // replacement char for ReplaceMany with chars + private static readonly char ReplacementChar = '*'; + + // replacements for ReplaceMany with dictionary + private static readonly IDictionary Replacements; + + // ReSharper restore ConvertToConstant.Local + + static StringReplaceManyBenchmarks() + { + // pick what you want to benchmark + + // short + Text = "1,2.3:4&5#6"; + + // long + //Text = "Sed ut perspiciatis unde omnis iste natus &error sit voluptatem accusantium doloremque l:audantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et &quasi architecto beatae vitae ::dicta sunt explicabo. Nemo enim ipsam volupta:tem quia voluptas sit aspernatur aut o&dit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciun&t. Neque porro quisquam est, qui dolorem: ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut e:nim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi co&&nsequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse: quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"; + + // short + Replacements = new Dictionary + { + { ",", "*" }, + { ".", "*" }, + { ":", "*" }, + { "&", "*" }, + { "#", "*" }, + }; + + // long + //Replacements = new Dictionary(); + //for (var i = 2; i < 100; i++) + // Replacements[Convert.ToChar(i).ToString()] = "*"; + } + + // this is what v7 originally did + [Benchmark(Description = "String.ReplaceMany w/chars - Aggregate", Baseline = true)] + public string ReplaceManyAggregate() + { + var result = Text; + return ReplacedChars.Aggregate(result, (current, c) => current.Replace(c, ReplacementChar)); + } + + [Benchmark(Description = "String.ReplaceMany w/chars - For Loop")] + public string ReplaceManyForLoop() + { + var result = Text; + + // ReSharper disable once LoopCanBeConvertedToQuery + // ReSharper disable once ForCanBeConvertedToForeach + for (var i = 0; i < ReplacedChars.Length; i++) + { + result = result.Replace(ReplacedChars[i], ReplacementChar); + } + + return result; + } + + // this is what v7 originally did + [Benchmark(Description = "String.ReplaceMany w/dictionary - Aggregate")] + public string ReplaceManyDictionaryAggregate() + { + return Replacements.Aggregate(Text, (current, kvp) => current.Replace(kvp.Key, kvp.Value)); + } + + [Benchmark(Description = "String.ReplaceMany w/dictionary - For Each")] + public string ReplaceManyDictionaryForEach() + { + var result = Text; + // ReSharper disable once LoopCanBeConvertedToQuery + foreach (var item in Replacements) + { + result = result.Replace(item.Key, item.Value); + } + + return result; + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests.Benchmarks/TryConvertToBenchmarks.cs b/src/Umbraco.Tests.Benchmarks/TryConvertToBenchmarks.cs new file mode 100644 index 0000000000..57b47dc1d0 --- /dev/null +++ b/src/Umbraco.Tests.Benchmarks/TryConvertToBenchmarks.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using BenchmarkDotNet.Attributes; +using Umbraco.Core; + +namespace Umbraco.Tests.Benchmarks +{ + [MemoryDiagnoser] + public class TryConvertToBenchmarks + { + private static readonly List List = new List() { "hello", "world", "awesome" }; + private static readonly string Date = "Saturday 10, November 2012"; + + [Benchmark(Description = "List to IEnumerable")] + public IEnumerable TryConvertToEnumerable() + { + return List.TryConvertTo>().Result; + } + + [Benchmark(Description = "Int to Double")] + public double TryConvertToDouble() + { + return 1.TryConvertTo().Result; + } + + [Benchmark(Description = "Float to Decimal")] + public decimal TryConvertToDecimal() + { + return 1F.TryConvertTo().Result; + } + + [Benchmark(Description = "String to Boolean")] + public bool TryConvertToBoolean() + { + return "1".TryConvertTo().Result; + } + + [Benchmark(Description = "String to DateTime")] + public DateTime TryConvertToDateTime() + { + return Date.TryConvertTo().Result; + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj b/src/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj index 5ce8d7d266..70474cdff0 100644 --- a/src/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj +++ b/src/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj @@ -14,6 +14,7 @@ + true AnyCPU @@ -40,35 +41,35 @@ Always - - ..\packages\BenchmarkDotNet.0.10.8\lib\net46\BenchmarkDotNet.dll + + ..\packages\BenchmarkDotNet.0.10.12\lib\net46\BenchmarkDotNet.dll - - ..\packages\BenchmarkDotNet.Core.0.10.8\lib\net46\BenchmarkDotNet.Core.dll + + ..\packages\BenchmarkDotNet.Core.0.10.12\lib\net46\BenchmarkDotNet.Core.dll - - ..\packages\BenchmarkDotNet.Diagnostics.Windows.0.10.8\lib\net46\BenchmarkDotNet.Diagnostics.Windows.dll + + ..\packages\BenchmarkDotNet.Diagnostics.Windows.0.9.9\lib\net45\BenchmarkDotNet.Diagnostics.Windows.dll - - ..\packages\BenchmarkDotNet.Toolchains.Roslyn.0.10.8\lib\net46\BenchmarkDotNet.Toolchains.Roslyn.dll + + ..\packages\BenchmarkDotNet.Toolchains.Roslyn.0.10.12\lib\net46\BenchmarkDotNet.Toolchains.Roslyn.dll ..\packages\Castle.Core.4.1.1\lib\net45\Castle.Core.dll - - ..\packages\Microsoft.CodeAnalysis.Common.2.3.0\lib\netstandard1.3\Microsoft.CodeAnalysis.dll - - - ..\packages\Microsoft.CodeAnalysis.CSharp.2.3.0\lib\netstandard1.3\Microsoft.CodeAnalysis.CSharp.dll - ..\packages\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.41\lib\net40\Microsoft.Diagnostics.Tracing.TraceEvent.dll + + ..\packages\Microsoft.CodeAnalysis.Common.2.4.0\lib\netstandard1.3\Microsoft.CodeAnalysis.dll + + + ..\packages\Microsoft.CodeAnalysis.CSharp.2.4.0\lib\netstandard1.3\Microsoft.CodeAnalysis.CSharp.dll + ..\packages\Microsoft.DotNet.InternalAbstractions.1.0.0\lib\net451\Microsoft.DotNet.InternalAbstractions.dll - - ..\packages\Microsoft.DotNet.PlatformAbstractions.1.1.2\lib\net451\Microsoft.DotNet.PlatformAbstractions.dll + + ..\packages\Microsoft.DotNet.PlatformAbstractions.1.1.1\lib\net451\Microsoft.DotNet.PlatformAbstractions.dll ..\packages\Microsoft.Win32.Registry.4.3.0\lib\net46\Microsoft.Win32.Registry.dll @@ -82,6 +83,7 @@ ..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll + True ..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll @@ -93,9 +95,8 @@ ..\packages\System.Console.4.3.0\lib\net46\System.Console.dll - - ..\packages\Microsoft.SqlServer.Compact.4.0.8876.1\lib\net40\System.Data.SqlServerCe.dll - True + + ..\packages\SqlServerCE.4.0.0.1\lib\System.Data.SqlServerCe.dll ..\packages\SqlServerCE.4.0.0.1\lib\System.Data.SqlServerCe.Entity.dll @@ -114,6 +115,7 @@ ..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll + True @@ -146,6 +148,10 @@ ..\packages\System.ValueTuple.4.4.0\lib\net461\System.ValueTuple.dll + + ..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net46\System.Security.Cryptography.X509Certificates.dll + True + @@ -167,18 +173,25 @@ + + + + + - - + + + Designer + @@ -194,10 +207,6 @@ Umbraco.Web - - - - @@ -217,11 +226,11 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.1\x86\*.* "$(TargetDir)x86\" - - \ No newline at end of file + diff --git a/src/Umbraco.Tests.Benchmarks/XmlBenchmarks.cs b/src/Umbraco.Tests.Benchmarks/XmlBenchmarks.cs index 99080ebab7..c7a5f6f0c2 100644 --- a/src/Umbraco.Tests.Benchmarks/XmlBenchmarks.cs +++ b/src/Umbraco.Tests.Benchmarks/XmlBenchmarks.cs @@ -8,27 +8,10 @@ using BenchmarkDotNet.Jobs; namespace Umbraco.Tests.Benchmarks { - [Config(typeof(Config))] + [QuickRunWithMemoryDiagnoserConfig] public class XmlBenchmarks { - private class Config : ManualConfig - { - public Config() - { - Add(new MemoryDiagnoser()); - //Add(ExecutionValidator.FailOnError); - - //The 'quick and dirty' settings, so it runs a little quicker - // see benchmarkdotnet FAQ - Add(Job.Default - .WithLaunchCount(1) // benchmark process will be launched only once - .WithIterationTime(TimeInterval.FromMilliseconds(100)) // 100ms per iteration - .WithWarmupCount(3) // 3 warmup iteration - .WithTargetCount(3)); // 3 target iteration - } - } - - [Setup] + [GlobalSetup] public void Setup() { var templateId = 0; @@ -67,7 +50,7 @@ namespace Umbraco.Tests.Benchmarks _xml.LoadXml(xmlText); } - [Cleanup] + [GlobalCleanup] public void Cleanup() { _xml = null; @@ -87,7 +70,7 @@ namespace Umbraco.Tests.Benchmarks public void XmlWithNavigation() { var elt = _xml.DocumentElement; - var id = NavigateElementRoute(elt, new[] {"home", "sub1", "sub2"}); + var id = NavigateElementRoute(elt, new[] { "home", "sub1", "sub2" }); if (id <= 0) Console.WriteLine("ERR"); } diff --git a/src/Umbraco.Tests.Benchmarks/XmlPublishedContentInitBenchmarks.cs b/src/Umbraco.Tests.Benchmarks/XmlPublishedContentInitBenchmarks.cs index dbb32b18f7..e5972a3505 100644 --- a/src/Umbraco.Tests.Benchmarks/XmlPublishedContentInitBenchmarks.cs +++ b/src/Umbraco.Tests.Benchmarks/XmlPublishedContentInitBenchmarks.cs @@ -18,25 +18,9 @@ using Umbraco.Web.PublishedCache.XmlPublishedCache; namespace Umbraco.Tests.Benchmarks { - [Config(typeof(Config))] + [QuickRunWithMemoryDiagnoserConfig] public class XmlPublishedContentInitBenchmarks { - private class Config : ManualConfig - { - public Config() - { - Add(new MemoryDiagnoser()); - - //The 'quick and dirty' settings, so it runs a little quicker - // see benchmarkdotnet FAQ - Add(Job.Default - .WithLaunchCount(1) // benchmark process will be launched only once - .WithIterationTime(TimeInterval.FromMilliseconds(100)) // 100ms per iteration - .WithWarmupCount(3) // 3 warmup iteration - .WithTargetCount(3)); // 3 target iteration - } - } - public XmlPublishedContentInitBenchmarks() { _xml10 = Build(10); diff --git a/src/Umbraco.Tests.Benchmarks/packages.config b/src/Umbraco.Tests.Benchmarks/packages.config index 8c7c2d2d56..f8d7dec738 100644 --- a/src/Umbraco.Tests.Benchmarks/packages.config +++ b/src/Umbraco.Tests.Benchmarks/packages.config @@ -1,62 +1,63 @@  - - + + - + - - + + - - + + - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file