Skip to content

Commit 1c6cd23

Browse files
authored
[Schema Registry Avro] Add perf test for deserialize (Azure#21265)
### Packages impacted by this PR @azure/schema-registry-avro ### Issues associated with this PR Related to Azure#16983 ### Describe the problem that is addressed by this PR Missing performance test for deserialize ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? N/A ### Are there test cases added in this PR? _(If not, why?)_ N/A ### Provide a list of related PRs _(if any)_ N/A ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [x] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [ ] Added a changelog (if necessary)
1 parent b6d1ad1 commit 1c6cd23

File tree

3 files changed

+48
-2
lines changed

3 files changed

+48
-2
lines changed

sdk/schemaregistry/perf-tests/schema-registry-avro/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@
77
3. Create an Event Hubs account and populate the `.env` file with the relevant credentials.
88
4. Run the tests as follows
99

10-
- detect language
10+
- serialize
1111
- `npm run perf-test:node -- SerializeTest --warmup 1 --iterations 10 --parallel 100 --duration 15 --items-count 1000`
12+
13+
- deserialize
14+
- `npm run perf-test:node -- DeserializeTest --warmup 1 --iterations 10 --parallel 100 --duration 15 --items-count 1000`
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT license.
3+
4+
import { AvroSerializerTest } from "./avroSerializerTest.spec";
5+
import { PerfOptionDictionary } from "@azure/test-utils-perf";
6+
import { MessageContent } from "@azure/schema-registry-avro";
7+
8+
interface SerializePerfTestOptions {
9+
"items-count": number;
10+
}
11+
12+
export class DeserializeTest extends AvroSerializerTest<SerializePerfTestOptions> {
13+
options: PerfOptionDictionary<SerializePerfTestOptions> = {
14+
"items-count": {
15+
required: false,
16+
description: "Number of array items",
17+
shortName: "n",
18+
longName: "items-count",
19+
defaultValue: 1000,
20+
},
21+
};
22+
private serialized: MessageContent | undefined;
23+
24+
constructor() {
25+
super();
26+
this.options = this.parsedOptions;
27+
}
28+
29+
async setup(): Promise<void> {
30+
this.serialized = await this.serializer.serialize(
31+
{
32+
name: "test",
33+
favoriteNumbers: [...Array(this.options["items-count"].value).keys()],
34+
},
35+
AvroSerializerTest.schema
36+
);
37+
}
38+
39+
async run(): Promise<void> {
40+
await this.serializer.deserialize(this.serialized!);
41+
}
42+
}

sdk/schemaregistry/perf-tests/schema-registry-avro/test/index.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33

44
import { PerfProgram, selectPerfTest } from "@azure/test-utils-perf";
55
import { SerializeTest } from "./serialize.spec";
6+
import { DeserializeTest } from "./deserialize.spec";
67

78
import dotenv from "dotenv";
89
dotenv.config();
910

1011
console.log("=== Starting the perf test ===");
1112

12-
const perfProgram = new PerfProgram(selectPerfTest([SerializeTest]));
13+
const perfProgram = new PerfProgram(selectPerfTest([SerializeTest, DeserializeTest]));
1314

1415
perfProgram.run();

0 commit comments

Comments
 (0)