Skip to content

Commit

Permalink
Add renderFormats to manual performance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mdaines committed Aug 30, 2024
1 parent 271c55f commit caf7a61
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/viz/test/manual/instance-reuse.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const tests = [
{ label: "string", fn: viz => viz.render(dotStringify(makeObject())) },
{ label: "string with labels", fn: viz => viz.render(dotStringify(makeObjectWithLabels())) },
{ label: "string with HTML labels", fn: viz => viz.render(dotStringify(makeObjectWithHTMLLabels())) },
{ label: "string with multiple formats", fn: viz => viz.renderFormats(dotStringify(makeObject()), ["svg", "cmapx"]) },
{ label: "object", fn: viz => viz.render(makeObject()) },
{ label: "object with labels", fn: viz => viz.render(makeObjectWithLabels()) },
{ label: "object with HTML labels", fn: viz => viz.render(makeObjectWithHTMLLabels()) },
Expand Down
32 changes: 32 additions & 0 deletions packages/viz/test/manual/performance-multiple.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { instance } from "../../src/standalone.mjs";
import { measure, randomGraph, dotStringify } from "./utils.mjs";

const tests = [
{ nodeCount: 100, randomEdgeCount: 10 },
{ nodeCount: 1000, randomEdgeCount: 50 },
{ nodeCount: 1000, randomEdgeCount: 500 },
{ nodeCount: 1000, randomEdgeCount: 1000 }
];

tests.forEach(test => {
test.input = dotStringify(randomGraph(test.nodeCount, test.randomEdgeCount));
});

const timeLimit = 5000;

for (const { input, nodeCount, randomEdgeCount } of tests) {
const viz = await instance();
const result = measure(() => {
viz.render(input, { format: "svg" });
viz.render(input, { format: "cmapx" });
}, timeLimit);
console.log(`render, ${nodeCount} nodes, ${randomEdgeCount} edges: ${result}`);
}

for (const { input, nodeCount, randomEdgeCount } of tests) {
const viz = await instance();
const result = measure(() => {
viz.renderFormats(input, ["svg", "cmapx"]);
}, timeLimit);
console.log(`renderFormats, ${nodeCount} nodes, ${randomEdgeCount} edges: ${result}`);
}

0 comments on commit caf7a61

Please sign in to comment.