mitata
mitata copied to clipboard
Bun crashes (Segmentation Fault) when running benchmarks against certain template engines
I want to create a set of performance comparisons of template engines running on Node or Bun, and decided to use Mitata as the benchmark framework because that's what the Bun project uses.
I have found several template engines -- EJS, Nunjucks, MarkdownIT so far -- that cause Bun to segfault when running the benchmark using Mitata. Full details are in the Bun issue queue: https://github.com/oven-sh/bun/issues/811
Reporting here because you may have an idea.
Simplest example is:
import { bench, run } from "mitata";
import * as ejs from 'ejs';
let people = ['geddy', 'neil', 'alex'];
bench('literal', () => { return `${people.join(', ')}`; });
bench('ejs-join', () => {
ejs.render('<%= people.join(", "); %>', { people: people });
});
try {
await run();
} catch (err) { console.error(err); }
If I run this code standalone (without Mitata) it executes perfectly on Bun. If I comment out the ejs-join stanza, it still segfaults, and if I comment out the import for ejs then Bun does not segfault.