Update names and descriptions for benchmarks (#18430)

This commit is contained in:
Pranav K 2020-01-21 14:43:34 -08:00 committed by GitHub
parent 419a1f11a9
commit ba08d60cb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 89 additions and 15 deletions

View File

@ -4,10 +4,21 @@ namespace Wasm.Performance.Driver
{
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; }
}
}
}

View File

@ -76,9 +76,9 @@ namespace Wasm.Performance.Driver
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"
});
@ -94,7 +94,7 @@ namespace Wasm.Performance.Driver
output.Metadata.Add(new BenchmarkMetadata
{
Source = "BlazorWasm",
Name = "Publish size",
Name = "blazorwasm/publish-size",
ShortDescription = "Publish size (KB)",
LongDescription = "Publish size (KB)",
Format = "n2",
@ -116,7 +116,7 @@ namespace Wasm.Performance.Driver
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",

View File

@ -10,6 +10,11 @@ group('App Startup', () => {
} finally {
app.dispose();
}
}, {
descriptor: {
name: "blazorwasm/time-to-first-ui",
description: "Time to render first UI (ms)"
}
});
});

View File

@ -16,22 +16,47 @@ group('JSON handling', () => {
teardown(() => app.dispose());
benchmark('Serialize 1kb', () =>
benchmarkJson(app, '#serialize-small', '#serialized-length', 935));
benchmarkJson(app, '#serialize-small', '#serialized-length', 935), {
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)', () => {
@ -39,6 +64,11 @@ group('JSON handling', () => {
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'
}
});
});

View File

@ -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 };
}
@ -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
});
}
});
}

View File

@ -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)'
}
});
});

View File

@ -14,6 +14,9 @@
"branchOrCommit": "blazor-wasm",
"dockerfile": "src/Components/benchmarkapps/Wasm.Performance/dockerfile"
},
"buildArguments": [
"gitBranch=blazor-wasm"
],
"waitForExit": true,
"readyStateText": "Application started."
}