diff --git a/test/Serilog.PerformanceTests/ForContext.cs b/test/Serilog.PerformanceTests/ForContextTests.cs
similarity index 98%
rename from test/Serilog.PerformanceTests/ForContext.cs
rename to test/Serilog.PerformanceTests/ForContextTests.cs
index f1e6ce60e..2a474c86f 100644
--- a/test/Serilog.PerformanceTests/ForContext.cs
+++ b/test/Serilog.PerformanceTests/ForContextTests.cs
@@ -25,7 +25,7 @@ namespace Serilog.PerformanceTests
///
/// From https://github.com/serilog/serilog/pull/750
///
- public class ForContext
+ public class ForContextTests
{
private ILogger log;
diff --git a/test/Serilog.PerformanceTests/FromLogContextPushProperty.cs b/test/Serilog.PerformanceTests/FromLogContextPushPropertyTests.cs
similarity index 98%
rename from test/Serilog.PerformanceTests/FromLogContextPushProperty.cs
rename to test/Serilog.PerformanceTests/FromLogContextPushPropertyTests.cs
index 63a78cf75..a0cd32b1c 100644
--- a/test/Serilog.PerformanceTests/FromLogContextPushProperty.cs
+++ b/test/Serilog.PerformanceTests/FromLogContextPushPropertyTests.cs
@@ -23,7 +23,7 @@
namespace Serilog.PerformanceTests
{
- public class FromLogContextPushProperty
+ public class FromLogContextPushPropertyTests
{
private ILogger log;
diff --git a/test/Serilog.PerformanceTests/Harness.cs b/test/Serilog.PerformanceTests/Harness.cs
index b2272912e..6ba154bba 100644
--- a/test/Serilog.PerformanceTests/Harness.cs
+++ b/test/Serilog.PerformanceTests/Harness.cs
@@ -26,13 +26,11 @@ namespace Serilog.PerformanceTests
// TODO:
// For Context
+ // MinimumLevel
+ // Push - ForContext
+ // Ctor of LogEvent
+ // Message Template parsing
- // Perf logger off
- // Perf level off - Debug -
-
- // LogContext Push
- // ctor logevent -
- // message template parser perf
// property binding perf (Bind message template)
public class Runner
@@ -40,19 +38,31 @@ public class Runner
[Fact]
public void ForContext()
{
- var context = BenchmarkRunner.Run();
+ var context = BenchmarkRunner.Run();
}
[Fact]
public void MinimumLevel()
{
- var context = BenchmarkRunner.Run();
+ var context = BenchmarkRunner.Run();
}
[Fact]
public void FromLogContextPushProperty()
{
- var context = BenchmarkRunner.Run();
+ var context = BenchmarkRunner.Run();
+ }
+
+ [Fact]
+ public void LogEvent()
+ {
+ var context = BenchmarkRunner.Run();
+ }
+
+ [Fact]
+ public void MessageTemplateParser()
+ {
+ var context = BenchmarkRunner.Run();
}
}
}
\ No newline at end of file
diff --git a/test/Serilog.PerformanceTests/LogEventTests.cs b/test/Serilog.PerformanceTests/LogEventTests.cs
new file mode 100644
index 000000000..7f62ff972
--- /dev/null
+++ b/test/Serilog.PerformanceTests/LogEventTests.cs
@@ -0,0 +1,72 @@
+
+// Copyright 2013-2016 Serilog Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+using BenchmarkDotNet.Attributes;
+using BenchmarkDotNet.Running;
+using Serilog.Tests.Support;
+using Serilog;
+using Serilog.Events;
+using Serilog.Parsing;
+using System;
+using System.Linq;
+using System.Collections;
+using System.Collections.Generic;
+using Xunit;
+
+namespace Serilog.PerformanceTests
+{
+ public class LogEventTests
+ {
+ List _properties;
+ Exception _exception;
+ MessageTemplate _emptyMessageTemplate;
+
+ [Setup]
+ public void Setup()
+ {
+ _exception = new Exception("An Error");
+ _emptyMessageTemplate = new MessageTemplate(Enumerable.Empty());
+ _properties = new List();
+
+ var items = Enumerable.Range(0,1000);
+ foreach (var item in items)
+ {
+ var prop = new LogEventProperty(item.ToString(), new ScalarValue(item));
+ _properties.Add(prop);
+ }
+ }
+
+ [Benchmark(Baseline = true)]
+ public void Baseline()
+ {
+ var le = new LogEvent(DateTimeOffset.Now,
+ LogEventLevel.Information,
+ _exception,
+ _emptyMessageTemplate,
+ Enumerable.Empty());
+ }
+
+ [Benchmark()]
+ public void LogEvent1000Properties()
+ {
+ var le = new LogEvent(DateTimeOffset.Now,
+ LogEventLevel.Information,
+ _exception,
+ _emptyMessageTemplate,
+ _properties);
+ }
+ }
+}
+
\ No newline at end of file
diff --git a/test/Serilog.PerformanceTests/MessageTemplateParserTests.cs b/test/Serilog.PerformanceTests/MessageTemplateParserTests.cs
new file mode 100644
index 000000000..b92e18d2f
--- /dev/null
+++ b/test/Serilog.PerformanceTests/MessageTemplateParserTests.cs
@@ -0,0 +1,54 @@
+
+// Copyright 2013-2016 Serilog Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+using BenchmarkDotNet.Attributes;
+using BenchmarkDotNet.Running;
+using Serilog.Tests.Support;
+using Serilog;
+using Serilog.Events;
+using Serilog.Parsing;
+using System;
+using System.Linq;
+using System.Collections;
+using System.Collections.Generic;
+using Xunit;
+
+namespace Serilog.PerformanceTests
+{
+ public class MessageTemplateParserTests
+ {
+ MessageTemplateParser _parser;
+ const string DefaultConsoleOutputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level}] {Message}{NewLine}{Exception}";
+
+ [Setup]
+ public void Setup()
+ {
+ _parser = new MessageTemplateParser();
+ }
+
+ [Benchmark(Baseline = true)]
+ public void Baseline()
+ {
+ var template = _parser.Parse("");
+ }
+
+ [Benchmark]
+ public void DefaultConsoleOutputTemplate()
+ {
+ var template = _parser.Parse(DefaultConsoleOutputTemplate);
+ }
+ }
+}
+
\ No newline at end of file
diff --git a/test/Serilog.PerformanceTests/MinimumLevel.cs b/test/Serilog.PerformanceTests/MinimumLevelTests.cs
similarity index 99%
rename from test/Serilog.PerformanceTests/MinimumLevel.cs
rename to test/Serilog.PerformanceTests/MinimumLevelTests.cs
index e8bfad949..4037d3206 100644
--- a/test/Serilog.PerformanceTests/MinimumLevel.cs
+++ b/test/Serilog.PerformanceTests/MinimumLevelTests.cs
@@ -24,7 +24,7 @@
namespace Serilog.PerformanceTests
{
- public class MinimumLevel
+ public class MinimumLevelTests
{
private ILogger log;
private LoggingLevelSwitch levelSwitch;
diff --git a/test/Serilog.PerformanceTests/project.json b/test/Serilog.PerformanceTests/project.json
index ec7536c64..be4e30936 100755
--- a/test/Serilog.PerformanceTests/project.json
+++ b/test/Serilog.PerformanceTests/project.json
@@ -20,7 +20,8 @@
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-rc2-3002702"
- }
+ },
+ "System.Collections": "4.0.11-rc2-24027",
},
"imports": [
"dnxcore50",