opencode/packages/codemode-rust/bench/variants/bench-string-building.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

10 lines
263 B
JavaScript

const BASE = "a".charCodeAt(0)
let text = ""
let idx = 0
while (idx < 5e4) {
text = text + String.fromCharCode(BASE + (idx % 26))
idx++
}
const pieces = []
for (let n = 0; n < 2e4; n += 1) pieces.push("item-" + n)
return text.length + pieces.join(",").length