Skip to content

Update names and descriptions for benchmarks #18430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,21 @@ class BenchmarkResult
{
public string Name { get; set; }

public BenchmarkDescriptor Descriptor { get; set; }

public string ShortDescription { get; set; }

public bool Success { get; set; }

public int NumExecutions { get; set; }

public double Duration { get; set; }

public class BenchmarkDescriptor
{
public string Name { get; set; }

public string Description { get; set; }
}
}
}
10 changes: 5 additions & 5 deletions src/Components/benchmarkapps/Wasm.Performance/Driver/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ private static void FormatAsBenchmarksOutput(List<BenchmarkResult> results)
output.Metadata.Add(new BenchmarkMetadata
{
Source = "BlazorWasm",
Name = result.Name,
ShortDescription = $"{result.Name} Duration",
LongDescription = $"{result.Name} Duration",
Name = result.Descriptor.Name,
ShortDescription = result.Name,
LongDescription = result.Descriptor.Description,
Format = "n2"
});

Expand All @@ -94,7 +94,7 @@ private static void FormatAsBenchmarksOutput(List<BenchmarkResult> results)
output.Metadata.Add(new BenchmarkMetadata
{
Source = "BlazorWasm",
Name = "Publish size",
Name = "blazorwasm/publish-size",
ShortDescription = "Publish size (KB)",
LongDescription = "Publish size (KB)",
Format = "n2",
Expand All @@ -116,7 +116,7 @@ private static void FormatAsBenchmarksOutput(List<BenchmarkResult> results)
output.Metadata.Add(new BenchmarkMetadata
{
Source = "BlazorWasm",
Name = "Publish size (compressed)",
Name = "blazorwasm/compressed-publish-size",
ShortDescription = "Publish size compressed app (KB)",
LongDescription = "Publish size - compressed app (KB)",
Format = "n2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ group('App Startup', () => {
} finally {
app.dispose();
}
}, {
descriptor: {
name: "blazorwasm/time-to-first-ui",
description: "Time to render first UI (ms)"
}
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,59 @@ group('JSON handling', () => {
teardown(() => app.dispose());

benchmark('Serialize 1kb', () =>
benchmarkJson(app, '#serialize-small', '#serialized-length', 935));
benchmarkJson(app, '#serialize-small', '#serialized-length', 935), {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SteveSandersonMS prior to this change, we were using the value of the name argument (in this case 'Serialize 1kb') as the names recorded by the benchmarking infrastructure. @sebastienros suggested we use less prosaic text and follow the pattern that the rest of the infrastructure uses. I took what was admittedly the easiest way to tack on additional content to a benchmark.

I'm happy with this change as is given that it's ultimately test infrastructure, but I'm open to changes if you feel there's a better way to approach this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the content we ultimately want to produce: https://gist.github.com/pranavkm/387f83d25600b4d30f7bfc52010227e3

descriptor: {
name: 'blazorwasm/jsonserialize-1kb',
description: 'Serialize JSON 1kb - Time in ms'
}
});

benchmark('Serialize 340kb', () =>
benchmarkJson(app, '#serialize-large', '#serialized-length', 339803));
benchmarkJson(app, '#serialize-large', '#serialized-length', 339803), {
descriptor: {
name: 'blazorwasm/jsonserialize-340kb',
description: 'Serialize JSON 340kb - Time in ms'
}
});

benchmark('Deserialize 1kb', () =>
benchmarkJson(app, '#deserialize-small', '#deserialized-count', 5));
benchmarkJson(app, '#deserialize-small', '#deserialized-count', 5), {
descriptor: {
name: 'blazorwasm/jsondeserialize-1kb',
description: 'Deserialize JSON 1kb - Time in ms'
}
});

benchmark('Deserialize 340kb', () =>
benchmarkJson(app, '#deserialize-large', '#deserialized-count', 1365));
benchmarkJson(app, '#deserialize-large', '#deserialized-count', 1365), {
descriptor: {
name: 'blazorwasm/jsondeserialize-340kb',
description: 'Deserialize JSON 340kb - Time in ms'
}
});

benchmark('Serialize 340kb (JavaScript)', () => {
const json = JSON.stringify(largeObjectToSerialize);
if (json.length !== 339803) {
throw new Error(`Incorrect length: ${json.length}`);
}
}, {
descriptor: {
name: 'blazorwasm/jsonserialize-javascript-340kb',
description: 'Serialize JSON 340kb using JavaScript - Time in ms'
}
});

benchmark('Deserialize 340kb (JavaScript)', () => {
const parsed = JSON.parse(largeJsonToDeserialize);
if (parsed.name !== 'CEO - Subordinate 0') {
throw new Error('Incorrect result');
}
}, {
descriptor: {
name: 'blazorwasm/jsondeserialize-javascript-340kb',
description: 'Deserialize JSON 340kb using JavaScript - Time in ms'
}
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class Benchmark extends EventEmitter {
this._group = group;
this.name = name;
this._fn = fn;
this._options = options;
this._options = options || {};
this._state = { status: BenchmarkStatus.idle };
}

Expand Down Expand Up @@ -205,13 +205,23 @@ class Benchmark extends EventEmitter {
await this._group.runTeardown();
}

reportBenchmarkEvent(BenchmarkEvent.benchmarkCompleted, { 'name': this.name, success: true, numExecutions: this._state.numExecutions, duration: this._state.estimatedExecutionDurationMs });
reportBenchmarkEvent(BenchmarkEvent.benchmarkCompleted, {
name: this.name,
success: true,
numExecutions: this._state.numExecutions,
duration: this._state.estimatedExecutionDurationMs,
descriptor: this._options.descriptor
});

this._updateState({ status: BenchmarkStatus.idle });
} catch (ex) {
this._updateState({ status: BenchmarkStatus.error });
console.error(ex);
reportBenchmarkEvent(BenchmarkEvent.benchmarkError, { 'name': this.name, success: false });
reportBenchmarkEvent(BenchmarkEvent.benchmarkError, {
name: this.name,
success: false,
descriptor: this._options.descriptor
});
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,24 @@ group('Rendering list', () => {
app.dispose();
});

benchmark('Render 10 items', () => measureRenderList(app, 10));
benchmark('Render 100 items', () => measureRenderList(app, 100));
benchmark('Render 1000 items', () => measureRenderList(app, 1000));
benchmark('Render 10 items', () => measureRenderList(app, 10), {
descriptor: {
name: 'blazorwasm/render-10-items',
description: 'Time to render 10 item list (ms)'
}
});
benchmark('Render 100 items', () => measureRenderList(app, 100), {
descriptor: {
name: 'blazorwasm/render-100-items',
description: 'Time to render 100 item list (ms)'
}
});
benchmark('Render 1000 items', () => measureRenderList(app, 1000), {
descriptor: {
name: 'blazorwasm/render-1000-items',
description: 'Time to render 1000 item list (ms)'
}
});

});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
"branchOrCommit": "blazor-wasm",
"dockerfile": "src/Components/benchmarkapps/Wasm.Performance/dockerfile"
},
"buildArguments": [
"gitBranch=blazor-wasm"
],
"waitForExit": true,
"readyStateText": "Application started."
}
Expand Down