opencode/packages/codemode-rust/bench/plugin/reducer-padded.js
Sebastian 85ffd4dc70 test(codemode): add perturbed variants and a plugin-event benchmark
Each bench program gets an equivalent, differently written variant in
bench/variants/, run next to its original on both implementations, with the
variant / original ratio per side. A plugin-event benchmark runs the
conformance reducer with a git.status tool as a 226-byte and a 3 KB source.
RESULTS.md labels medians, mins and means, computes speed-ups from medians
only, and notes that the reference tools validate through Effect Schema.
2026-11-18 18:53:57 +01:00

14 lines
No EOL
2.9 KiB
JavaScript

if (event.type === "init") return { state: { runs: 0 }, commands: [{ name: "git.status", key: "ctrl+g" }] }
if (event.type === "command" && event.name === "git.log") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.log" }, slots: { statusbar: { text: "log " + s.branch + (s.dirty ? " *" : "") } } } }
if (event.type === "command" && event.name === "git.diff") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.diff" }, slots: { statusbar: { text: "diff " + s.branch + (s.dirty ? " *" : "") } } } }
if (event.type === "command" && event.name === "git.branch") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.branch" }, slots: { statusbar: { text: "branch " + s.branch + (s.dirty ? " *" : "") } } } }
if (event.type === "command" && event.name === "git.stash") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.stash" }, slots: { statusbar: { text: "stash " + s.branch + (s.dirty ? " *" : "") } } } }
if (event.type === "command" && event.name === "git.fetch") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.fetch" }, slots: { statusbar: { text: "fetch " + s.branch + (s.dirty ? " *" : "") } } } }
if (event.type === "command" && event.name === "git.pull") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.pull" }, slots: { statusbar: { text: "pull " + s.branch + (s.dirty ? " *" : "") } } } }
if (event.type === "command" && event.name === "git.push") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.push" }, slots: { statusbar: { text: "push " + s.branch + (s.dirty ? " *" : "") } } } }
if (event.type === "command" && event.name === "git.commit") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.commit" }, slots: { statusbar: { text: "commit " + s.branch + (s.dirty ? " *" : "") } } } }
if (event.type === "command" && event.name === "git.reset") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.reset" }, slots: { statusbar: { text: "reset " + s.branch + (s.dirty ? " *" : "") } } } }
if (event.type === "command" && event.name === "git.merge") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.merge" }, slots: { statusbar: { text: "merge " + s.branch + (s.dirty ? " *" : "") } } } }
if (event.type === "command" && event.name === "git.rebase") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.rebase" }, slots: { statusbar: { text: "rebase " + s.branch + (s.dirty ? " *" : "") } } } }
if (event.type === "command" && event.name === "git.status") { const s = await tools.git.status(); return { state: { runs: state.runs + 1 }, slots: { statusbar: { text: s.branch + (s.dirty ? " *" : "") } } } }
return { state }