MCPcopy Create free account
hub / github.com/avoidwork/tenso / benchmarkSerializerComparison

Function benchmarkSerializerComparison

benchmarks/serializers.js:167–203  ·  view source on GitHub ↗

* Benchmarks serializer comparison for different MIME types

()

Source from the content-addressed store, hash-verified

165 * Benchmarks serializer comparison for different MIME types
166 */
167function benchmarkSerializerComparison () {
168 console.log("📊 Serializer Comparison (Medium datasets)");
169 console.log("-".repeat(40));
170
171 const customSerializer = serializers.get("application/json");
172 const plainSerializer = serializers.get("text/plain");
173 const xmlCustom = serializers.get("application/xml");
174 const csvPlain = serializers.get("text/csv");
175 const yamlCustom = serializers.get("application/yaml");
176
177 const suite = new Benchmark.Suite();
178
179 suite
180 .add("Custom Serializer (JSON)", () => {
181 customSerializer(testData.medium, null, 200);
182 })
183 .add("Plain Serializer (text)", () => {
184 plainSerializer(testData.medium, null, 200);
185 })
186 .add("Custom Serializer (XML)", () => {
187 xmlCustom(testData.medium, null, 200);
188 })
189 .add("Plain Serializer (CSV)", () => {
190 csvPlain(testData.medium, null, 200);
191 })
192 .add("Custom Serializer (YAML)", () => {
193 yamlCustom(testData.medium, null, 200);
194 })
195 .on("cycle", event => {
196 console.log(` ${String(event.target)}`);
197 })
198 .on("complete", function () {
199 console.log(` Fastest: ${this.filter("fastest").map("name")}`);
200 console.log(` Slowest: ${this.filter("slowest").map("name")}\n`);
201 })
202 .run({ async: false });
203}
204
205/**
206 * Benchmarks error handling performance

Callers 1

mainFunction · 0.85

Calls 1

logMethod · 0.80

Tested by

no test coverage detected