mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-23 00:32:50 +08:00
Added some benchmarke benchmark stuff
This commit is contained in:
parent
d3b9fddcfd
commit
0421dba1e2
234
test/Ocelot.Benchmarks/.gitignore
vendored
Normal file
234
test/Ocelot.Benchmarks/.gitignore
vendored
Normal file
@ -0,0 +1,234 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
build/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# Visual Studio 2015 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# DNX
|
||||
project.lock.json
|
||||
artifacts/
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Microsoft Azure ApplicationInsights config file
|
||||
ApplicationInsights.config
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
orleans.codegen.cs
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
@ -0,0 +1,20 @@
|
||||
```ini
|
||||
|
||||
Host Process Environment Information:
|
||||
BenchmarkDotNet=v0.9.8.0
|
||||
OS=OSX
|
||||
Processor=?, ProcessorCount=4
|
||||
Frequency=1000000000 ticks, Resolution=1.0000 ns, Timer=UNKNOWN
|
||||
CLR=CORE, Arch=64-bit ? [RyuJIT]
|
||||
GC=Concurrent Workstation
|
||||
JitModules=?
|
||||
dotnet cli version: 1.0.0-preview2-003121
|
||||
|
||||
Type=UrlPathToUrlPathTemplateMatcherBenchmarks Mode=Throughput Toolchain=Core
|
||||
GarbageCollection=Concurrent Workstation
|
||||
|
||||
```
|
||||
Method | Median | StdDev | Mean | StdError | StdDev | Op/s | Min | Q1 | Median | Q3 | Max |
|
||||
----------- |------------ |---------- |------------ |---------- |---------- |----------- |------------ |------------ |------------ |------------ |------------ |
|
||||
Benchmark1 | 180.4251 ns | 4.1294 ns | 180.4400 ns | 0.9234 ns | 4.1294 ns | 5542007.02 | 174.5503 ns | 177.6286 ns | 180.4251 ns | 182.5334 ns | 190.9792 ns |
|
||||
Benchmark2 | 178.7267 ns | 6.1670 ns | 180.6081 ns | 1.3148 ns | 6.1670 ns | 5536849.8 | 174.0821 ns | 177.0992 ns | 178.7267 ns | 182.1962 ns | 198.1308 ns |
|
@ -0,0 +1,3 @@
|
||||
Type;Method;Mode;Platform;Jit;Toolchain;Runtime;GarbageCollection;LaunchCount;WarmupCount;TargetCount;Affinity;Median;StdDev;Mean;StdError;StdDev;Op/s;Min;Q1;Median;Q3;Max
|
||||
UrlPathToUrlPathTemplateMatcherBenchmarks;Benchmark1;Throughput;Host;Host;Core;Host;Concurrent Workstation;Auto;Auto;Auto;Auto;180.4251 ns;4.1294 ns;180.4400 ns;0.9234 ns;4.1294 ns;5542007.02;174.5503 ns;177.6286 ns;180.4251 ns;182.5334 ns;190.9792 ns
|
||||
UrlPathToUrlPathTemplateMatcherBenchmarks;Benchmark2;Throughput;Host;Host;Core;Host;Concurrent Workstation;Auto;Auto;Auto;Auto;178.7267 ns;6.1670 ns;180.6081 ns;1.3148 ns;6.1670 ns;5536849.8;174.0821 ns;177.0992 ns;178.7267 ns;182.1962 ns;198.1308 ns
|
|
@ -0,0 +1,20 @@
|
||||
<pre><code>
|
||||
Host Process Environment Information:
|
||||
BenchmarkDotNet=v0.9.8.0
|
||||
OS=OSX
|
||||
Processor=?, ProcessorCount=4
|
||||
Frequency=1000000000 ticks, Resolution=1.0000 ns, Timer=UNKNOWN
|
||||
CLR=CORE, Arch=64-bit ? [RyuJIT]
|
||||
GC=Concurrent Workstation
|
||||
JitModules=?
|
||||
dotnet cli version: 1.0.0-preview2-003121
|
||||
</code></pre>
|
||||
<pre><code>Type=UrlPathToUrlPathTemplateMatcherBenchmarks Mode=Throughput Toolchain=Core
|
||||
GarbageCollection=Concurrent Workstation
|
||||
</code></pre>
|
||||
|
||||
<table>
|
||||
<tr><th>Method</th><th>Median</th><th>StdDev</th><th> Mean</th><th>StdError</th><th>StdDev</th><th>Op/s</th><th> Min</th><th> Q1</th><th>Median</th><th> Q3</th><th> Max</th>
|
||||
</tr><tr><td>Benchmark1</td><td>180.4251 ns</td><td>4.1294 ns</td><td>180.4400 ns</td><td>0.9234 ns</td><td>4.1294 ns</td><td>5542007.02</td><td>174.5503 ns</td><td>177.6286 ns</td><td>180.4251 ns</td><td>182.5334 ns</td><td>190.9792 ns</td>
|
||||
</tr><tr><td>Benchmark2</td><td>178.7267 ns</td><td>6.1670 ns</td><td>180.6081 ns</td><td>1.3148 ns</td><td>6.1670 ns</td><td>5536849.8</td><td>174.0821 ns</td><td>177.0992 ns</td><td>178.7267 ns</td><td>182.1962 ns</td><td>198.1308 ns</td>
|
||||
</tr></table>
|
16
test/Ocelot.Benchmarks/Program.cs
Normal file
16
test/Ocelot.Benchmarks/Program.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using BenchmarkDotNet.Running;
|
||||
|
||||
namespace Ocelot.Benchmarks
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var summary = BenchmarkRunner.Run<UrlPathToUrlPathTemplateMatcherBenchmarks>();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Columns;
|
||||
using BenchmarkDotNet.Configs;
|
||||
using BenchmarkDotNet.Jobs;
|
||||
using Ocelot.Library.Infrastructure.UrlPathMatcher;
|
||||
|
||||
|
||||
namespace Ocelot.Benchmarks
|
||||
{
|
||||
[Config(typeof(UrlPathToUrlPathTemplateMatcherBenchmarks))]
|
||||
public class UrlPathToUrlPathTemplateMatcherBenchmarks : ManualConfig
|
||||
{
|
||||
private UrlPathToUrlPathTemplateMatcher _urlPathMatcher;
|
||||
private string _downstreamUrlPath;
|
||||
private string _downstreamUrlPathTemplate;
|
||||
|
||||
public UrlPathToUrlPathTemplateMatcherBenchmarks()
|
||||
{
|
||||
Add(StatisticColumn.AllStatistics);
|
||||
}
|
||||
|
||||
[Setup]
|
||||
public void SetUp()
|
||||
{
|
||||
_urlPathMatcher = new UrlPathToUrlPathTemplateMatcher();
|
||||
_downstreamUrlPath = "api/product/products/1/variants/?soldout=false";
|
||||
_downstreamUrlPathTemplate = "api/product/products/{productId}/variants/";
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
public void Benchmark1()
|
||||
{
|
||||
_urlPathMatcher.Match(_downstreamUrlPath, _downstreamUrlPathTemplate);
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
public void Benchmark2()
|
||||
{
|
||||
_urlPathMatcher.Match(_downstreamUrlPath, _downstreamUrlPathTemplate);
|
||||
}
|
||||
}
|
||||
}
|
28
test/Ocelot.Benchmarks/project.json
Normal file
28
test/Ocelot.Benchmarks/project.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"version": "1.0.0-*",
|
||||
"buildOptions": {
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"version": "1.0.0",
|
||||
"type": "platform"
|
||||
},
|
||||
"BenchmarkDotNet": "0.9.8",
|
||||
"Ocelot.Library": "1.0.0-*"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
"imports": [
|
||||
"dotnet5.6",
|
||||
"portable-net45+win8"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
"tooling": {
|
||||
"defaultNamespace": "Ocelot.Benchmarks"
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user