Skip to content

Commit 3a40d43

Browse files
committed
bench(*): run new benchmarks
1 parent e8d6781 commit 3a40d43

4 files changed

+31
-9
lines changed

benchmarks/BenchmarkDotNet.Artifacts/results/Benchmarks.Query.QueryParser_Benchmarks-report-github.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ BenchmarkDotNet=v0.10.10, OS=Mac OS X 10.12
44
Processor=Intel Core i5-5257U CPU 2.70GHz (Broadwell), ProcessorCount=4
55
.NET Core SDK=2.0.0
66
[Host] : .NET Core 1.1.4 (Framework 4.6.25714.03), 64bit RyuJIT
7-
Job-ROPOBW : .NET Core 1.1.4 (Framework 4.6.25714.03), 64bit RyuJIT
7+
Job-OWXJBF : .NET Core 1.1.4 (Framework 4.6.25714.03), 64bit RyuJIT
88

99
LaunchCount=3 TargetCount=20 WarmupCount=10
1010

1111
```
12-
| Method | Mean | Error | StdDev |
13-
|--------------- |---------:|----------:|----------:|
14-
| AscendingSort | 3.101 us | 0.0298 us | 0.0636 us |
15-
| DescendingSort | 3.195 us | 0.0297 us | 0.0632 us |
12+
| Method | Mean | Error | StdDev | Median |
13+
|--------------- |-------------:|-----------:|------------:|-------------:|
14+
| AscendingSort | 4.451 us | 1.5230 us | 3.2457 us | 3.305 us |
15+
| DescendingSort | 3.287 us | 0.0307 us | 0.0673 us | 3.263 us |
16+
| ComplexQuery | 1,973.029 us | 67.5600 us | 143.9759 us | 1,952.663 us |

benchmarks/BenchmarkDotNet.Artifacts/results/Benchmarks.Serialization.JsonApiDeserializer_Benchmarks-report-github.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ Processor=Intel Core i5-5257U CPU 2.70GHz (Broadwell), ProcessorCount=4
1010
```
1111
| Method | Mean | Error | StdDev |
1212
|------------------------ |---------:|----------:|----------:|
13-
| DeserializeSimpleObject | 26.37 us | 0.4458 us | 0.4170 us |
13+
| DeserializeSimpleObject | 27.05 us | 0.5353 us | 0.5950 us |

benchmarks/BenchmarkDotNet.Artifacts/results/Benchmarks.Serialization.JsonApiSerializer_Benchmarks-report-github.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ Processor=Intel Core i5-5257U CPU 2.70GHz (Broadwell), ProcessorCount=4
88

99

1010
```
11-
| Method | Mean | Error | StdDev |
12-
|------------------------ |---------:|----------:|----------:|
13-
| DeserializeSimpleObject | 7.135 us | 0.1401 us | 0.1439 us |
11+
| Method | Mean | Error | StdDev |
12+
|---------------------- |---------:|----------:|----------:|
13+
| SerializeSimpleObject | 7.195 us | 0.1436 us | 0.1816 us |

benchmarks/Query/QueryParser_Benchmarks.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Collections.Generic;
23
using BenchmarkDotNet.Attributes;
34
using BenchmarkDotNet.Attributes.Exporters;
@@ -6,6 +7,8 @@
67
using JsonApiDotNetCore.Internal;
78
using JsonApiDotNetCore.Models;
89
using JsonApiDotNetCore.Services;
10+
using Microsoft.AspNetCore.Http.Internal;
11+
using Microsoft.Extensions.Primitives;
912
using Moq;
1013

1114
namespace Benchmarks.Query {
@@ -36,6 +39,24 @@ public QueryParser_Benchmarks() {
3639
[Benchmark]
3740
public void DescendingSort() => _queryParser._ParseSortParameters(DESCENDING_SORT);
3841

42+
[Benchmark]
43+
public void ComplexQuery() => Run(100, () => _queryParser.Parse(
44+
new QueryCollection(
45+
new Dictionary<string, StringValues> {
46+
{ $"filter[{ATTRIBUTE}]", new StringValues(new [] { "abc", "eq:abc" }) },
47+
{ $"sort", $"-{ATTRIBUTE}" },
48+
{ $"include", "relationship" },
49+
{ $"page[size]", "1" },
50+
{ $"fields[resource]", ATTRIBUTE },
51+
}
52+
)
53+
));
54+
55+
private void Run(int iterations, Action action) {
56+
for (int i = 0; i < iterations; i++)
57+
action();
58+
}
59+
3960
// this facade allows us to expose and micro-benchmark protected methods
4061
private class BenchmarkFacade : QueryParser {
4162
public BenchmarkFacade(

0 commit comments

Comments
 (0)