Skip to content

Commit

Permalink
Remove lodash.template from the benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
emilos committed Apr 18, 2024
1 parent eef0dab commit 8829856
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 65 deletions.
18 changes: 6 additions & 12 deletions benchmark/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const {
} = require("fs")
const { Suite } = require("benchmark")
const underscore = require("underscore")
const template = require("lodash.template")
const handlebars = require("handlebars")
const mustache = require("mustache")
const { compile } = require("..")
Expand Down Expand Up @@ -34,10 +33,9 @@ async function benchmark(dir) {
path.join(__dirname, `./fixtures/${dir}/boxwood.js`)
)
const fn2 = underscore.template(source2)
const fn3 = template(source3)
const fn4 = handlebars.compile(source4)
const fn5 = (data) => mustache.render(source5, data)
const fn6 = require(path.join(__dirname, `./fixtures/${dir}/vanilla.js`))
const fn3 = handlebars.compile(source4)
const fn4 = (data) => mustache.render(source5, data)
const fn5 = require(path.join(__dirname, `./fixtures/${dir}/vanilla.js`))
mustache.parse(source5)

const data = require(path.join(__dirname, `./fixtures/${dir}/data.json`))
Expand All @@ -52,27 +50,23 @@ async function benchmark(dir) {
assert.deepEqual(result, normalize(fn3(data)))
assert.deepEqual(result, normalize(fn4(data)))
assert.deepEqual(result, normalize(fn5(data)))
assert.deepEqual(result, normalize(fn6(data)))

await new Promise((resolve) => {
suite
.add("vanilla[js]", function () {
fn6(data)
fn5(data)
})
.add("boxwood[js]", function () {
fn1(data)
})
.add("underscore[ejs]", function () {
fn2(data)
})
.add("lodash[ejs]", function () {
fn3(data)
})
.add("handlebars[hbs]", function () {
fn4(data)
fn3(data)
})
.add("mustache[mst]", function () {
fn5(data)
fn4(data)
})
.on("cycle", function (event) {
console.log(`${dir}: ${String(event.target)}`)
Expand Down
53 changes: 1 addition & 52 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"express": "^4.19.2",
"handlebars": "^4.7.8",
"jsdom": "^24.0.0",
"lodash.template": "4.5.0",
"mustache": "^4.2.0",
"underscore": "^1.13.6"
},
Expand Down

0 comments on commit 8829856

Please sign in to comment.