-
Notifications
You must be signed in to change notification settings - Fork 332
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We now have two options: - Compare to the same environment/type for a different commit - Compare with the same commit/type for all matching environments
- Loading branch information
Showing
10 changed files
with
203 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/NodaTime.Web/ViewModels/CompareTypesByEnvironmentViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright 2017 The Noda Time Authors. All rights reserved. | ||
// Use of this source code is governed by the Apache License 2.0, | ||
// as found in the LICENSE.txt file. | ||
using MoreLinq; | ||
using NodaTime.Benchmarks; | ||
using NodaTime.Web.Helpers; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace NodaTime.Web.ViewModels | ||
{ | ||
/// <summary> | ||
/// View-model for comparing multiple runs of the same type at the same commit. | ||
/// </summary> | ||
public class CompareTypesByEnvironmentViewModel | ||
{ | ||
public IList<BenchmarkType> Types { get; } | ||
public BenchmarkType TargetType { get; } | ||
|
||
public CompareTypesByEnvironmentViewModel(IList<BenchmarkType> types) | ||
{ | ||
Types = types; | ||
TargetType = Types.First(); | ||
} | ||
|
||
// TODO: Handle missing benchmarks | ||
public IEnumerable<(Benchmark description, IEnumerable<Statistics> statistics)> GetBenchmarks() | ||
{ | ||
List<Dictionary<string, Statistics>> statisticsByNameInTypeOrder = Types | ||
.Select(t => t.Benchmarks.ToDictionary(tb => tb.Method, tb => tb.Statistics)) | ||
.ToList(); | ||
return TargetType.Benchmarks | ||
.OrderBy(b => b.Method) | ||
.Select(b => (b, statisticsByNameInTypeOrder.Select(d => d.GetValueOrDefault(b.Method)))); | ||
} | ||
|
||
/* TODO: Reinstate this, on a per cell basis | ||
private static bool IsImportant(Statistics left, Statistics right) | ||
{ | ||
if (left == null || right == null) | ||
{ | ||
return false; | ||
} | ||
// Just in case we have strange results that might cause problems on division. (If something takes | ||
// less than a picosecond, I'm suspicious...) | ||
if (left.Mean < 0.001 || right.Mean < 0.001) | ||
{ | ||
return true; | ||
} | ||
double min = Math.Min(left.Mean, right.Mean); | ||
double max = Math.Max(left.Mean, right.Mean); | ||
return min / max < 0.8; // A 20% change either way is important. (Arbitrary starting point...) | ||
} */ | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
src/NodaTime.Web/Views/Benchmarks/CompareTypesByCommit.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
@using NodaTime.Web.ViewModels; | ||
@model CompareTypesByCommitViewModel | ||
|
||
@{ | ||
ViewBag.Title = "Benchmark type comparison"; | ||
} | ||
|
||
<div class="row"> | ||
<div> | ||
<h1>Benchmark type comparison for @Model.Left.FullTypeName</h1> | ||
</div> | ||
<div> | ||
Environment: <a href="/benchmarks/environments/@Model.Environment.BenchmarkEnvironmentId">@Model.Environment.Machine, @Model.Environment.TargetFramework</a><br /> | ||
Left run: <a href="/benchmarks/runs/@Model.Left.Run.BenchmarkRunId">@Model.Left.Run.BenchmarkRunId.TruncateGuid()</a> | ||
(@Html.RenderTimestamp(@Model.Left.Run.Start)); | ||
commit <a href="https://github.com/nodatime/nodatime/commit/@Model.Left.Run.Commit">@Model.Left.Run.Commit.TruncateCommit()</a><br /> | ||
Right run: <a href="/benchmarks/runs/@Model.Right.Run.BenchmarkRunId">@Model.Right.Run.BenchmarkRunId.TruncateGuid()</a> | ||
(@Html.RenderTimestamp(@Model.Right.Run.Start)); | ||
commit <a href="https://github.com/nodatime/nodatime/commit/@Model.Right.Run.Commit">@Model.Right.Run.Commit.TruncateCommit()</a><br /> | ||
</div> | ||
<div> | ||
<h2>Benchmarks</h2> | ||
</div> | ||
<div> | ||
<table> | ||
@* TODO: Parameters, if we ever use them. *@ | ||
<tr> | ||
<th>Method</th> | ||
<th>Mean time (left)</th> | ||
<th>Mean time (right)</th> | ||
</tr> | ||
@foreach (var item in Model.GetBenchmarks()) | ||
{ | ||
<tr class="@(item.important ? "benchmark-important": "")"> | ||
<td>@item.description.Method</td> | ||
<td>@Html.RenderTime(item.left?.Mean)</td> | ||
<td>@Html.RenderTime(item.right?.Mean)</td> | ||
</tr> | ||
} | ||
</table> | ||
</div> | ||
@* Work out how to style the above to leave some padding instead... *@ | ||
<p /> | ||
</div> |
44 changes: 44 additions & 0 deletions
44
src/NodaTime.Web/Views/Benchmarks/CompareTypesByEnvironment.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
@using NodaTime.Web.ViewModels; | ||
@model CompareTypesByEnvironmentViewModel | ||
|
||
@{ | ||
ViewBag.Title = "Benchmark type comparison"; | ||
} | ||
|
||
<div class="row"> | ||
<div> | ||
<h1>Benchmark environment comparison for @Model.TargetType.FullTypeName</h1> | ||
</div> | ||
<div> | ||
<p> | ||
Type @Model.TargetType.FullTypeName at commit <a href="https://github.com/nodatime/nodatime/commit/@Model.TargetType.Run.Commit">@Model.TargetType.Run.Commit.TruncateCommit()</a> | ||
</p> | ||
</div> | ||
<div> | ||
<h2>Benchmarks</h2> | ||
</div> | ||
<div> | ||
<table> | ||
@* TODO: Parameters, if we ever use them. *@ | ||
<tr> | ||
<th>Method</th> | ||
@foreach (var type in Model.Types) | ||
{ | ||
<th><a href="/benchmarks/types/@type.BenchmarkTypeId">@type.Environment.Machine<br />@type.Environment.TargetFramework<br />@type.Environment.BriefOperatingSystem</a></th> | ||
} | ||
</tr> | ||
@foreach (var item in Model.GetBenchmarks()) | ||
{ | ||
<tr> | ||
<td>@item.description.Method</td> | ||
@foreach (var stat in item.statistics) | ||
{ | ||
<td>@Html.RenderTime(stat?.Mean)</td> | ||
} | ||
</tr> | ||
} | ||
</table> | ||
</div> | ||
@* Work out how to style the above to leave some padding instead... *@ | ||
<p /> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters