mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-03-17 03:11:01 +00:00
Refactor: Remove stale benchmark outputs
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
async function renderTemplate(template, data) {
|
||||
const { default: Handlebars } = await import("https://cdn.jsdelivr.net/npm/handlebars@4.7.8/+esm");
|
||||
return Handlebars.compile(template)(data);
|
||||
}
|
||||
export default renderTemplate;
|
||||
// Generation time: 1.747s
|
||||
// Result: PASS
|
||||
@@ -1,7 +0,0 @@
|
||||
async function renderTemplate(template, data) {
|
||||
const { default: Handlebars } = await import("https://cdn.jsdelivr.net/npm/handlebars@4.7.8/+esm");
|
||||
return Handlebars.compile(template)(data);
|
||||
}
|
||||
export default renderTemplate;
|
||||
// Generation time: 2.282s
|
||||
// Result: PASS
|
||||
@@ -1,7 +0,0 @@
|
||||
const renderTemplate = async (template, data) => {
|
||||
const { default: hb } = await import('https://esm.sh/handlebars');
|
||||
return hb.compile(template)(data);
|
||||
};
|
||||
export default renderTemplate;
|
||||
// Generation time: 14.517s
|
||||
// Result: PASS
|
||||
@@ -1,7 +0,0 @@
|
||||
async function renderTemplate(template, data) {
|
||||
window.Handlebars || await import('https://cdn.jsdelivr.net/npm/handlebars@4.7.7/dist/handlebars.min.js');
|
||||
return window.Handlebars.compile(template)(data);
|
||||
}
|
||||
export default renderTemplate;
|
||||
// Generation time: 42.558s
|
||||
// Result: FAIL
|
||||
@@ -1,20 +0,0 @@
|
||||
export async function renderTemplate(template, data) {
|
||||
const load = async () => {
|
||||
try {
|
||||
const src = 'https://cdn.jsdelivr.net/npm/handlebars@4.7.7/dist/handlebars.min.js'
|
||||
const mod = await import(src)
|
||||
return mod.default || mod.Handlebars || mod
|
||||
} catch (e) {
|
||||
const alt = 'https://unpkg.com/handlebars@4.7.7/dist/handlebars.min.js'
|
||||
const mod2 = await import(alt)
|
||||
return mod2.default || mod2.Handlebars || mod2
|
||||
}
|
||||
}
|
||||
const hbs = await load()
|
||||
const s = String(template)
|
||||
const f = hbs.compile(s, { noEscape: false })
|
||||
return f(data)
|
||||
}
|
||||
export default renderTemplate;
|
||||
// Generation time: 13.350s
|
||||
// Result: FAIL
|
||||
@@ -1,12 +0,0 @@
|
||||
let hb;
|
||||
export const renderTemplate=async(t,d)=>{
|
||||
try{
|
||||
hb??=(await import('https://cdn.jsdelivr.net/npm/handlebars@4.7.8/dist/handlebars.mjs')).default;
|
||||
return hb.compile(t)(d);
|
||||
}catch(e){
|
||||
throw new Error(`Render failed: ${e.message}`);
|
||||
}
|
||||
};
|
||||
export default renderTemplate;
|
||||
// Generation time: 50.722s
|
||||
// Result: FAIL
|
||||
@@ -1,7 +0,0 @@
|
||||
export const renderTemplate=async(template,data)=>{
|
||||
const {default:Handlebars}=await import('https://cdn.jsdelivr.net/npm/handlebars@latest/+esm')
|
||||
return Handlebars.compile(template)(data)
|
||||
}
|
||||
export default renderTemplate;
|
||||
// Generation time: 4.362s
|
||||
// Result: PASS
|
||||
@@ -1,7 +0,0 @@
|
||||
async function renderTemplate(tpl, data) {
|
||||
const { default: h } = await import('https://cdn.jsdelivr.net/npm/handlebars@latest/dist/handlebars.esm.js')
|
||||
return h.compile(tpl)(data)
|
||||
}
|
||||
export default renderTemplate;
|
||||
// Generation time: 2.868s
|
||||
// Result: FAIL
|
||||
@@ -1,17 +0,0 @@
|
||||
const HANDLEBARS_CDN = "https://cdn.jsdelivr.net/npm/handlebars@4.7.8/+esm"
|
||||
|
||||
let hbP
|
||||
const tplCache = new Map()
|
||||
|
||||
const loadHB = () => hbP ??= import(HANDLEBARS_CDN).then(m => m.default ?? m)
|
||||
|
||||
async function renderTemplate(template, data = {}) {
|
||||
if (typeof template != "string") throw new TypeError("Template must be a string")
|
||||
const HB = await loadHB()
|
||||
let fn = tplCache.get(template)
|
||||
fn || tplCache.set(template, fn = HB.compile(template))
|
||||
return fn(data ?? {})
|
||||
}
|
||||
export default renderTemplate;
|
||||
// Generation time: 77.305s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user