Skip to content

Commit ac08a8c

Browse files
author
Wanasit Tanakitrungruang
committedMar 21, 2021
New: Adding basic benchmark
1 parent 4350642 commit ac08a8c

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
 

‎.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ package-lock.json
66
# Coverages
77
coverage/
88

9+
# Benchmarking
10+
benchmark/results
11+
*.log
12+
913
# Misc
1014
.Rhistory
1115
.idea/

‎benchmark/benchmark.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const chrono = require("..");
2+
const b = require("benny");
3+
4+
b.suite(
5+
"Example",
6+
7+
b.add("Parsing empty string", () => {
8+
chrono.parse("");
9+
}),
10+
11+
b.add("Parsing slash date - 11/12/2021", () => {
12+
chrono.en.parseDate("11/12/2021");
13+
}),
14+
15+
b.cycle(),
16+
b.complete(),
17+
b.save({ file: "chrono", format: "chart.html" })
18+
);

‎package.json

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@types/jest": "^26.0.4",
2727
"@typescript-eslint/eslint-plugin": "^4.7.0",
2828
"@typescript-eslint/parser": "^4.7.0",
29+
"benny": "^3.6.15",
2930
"eslint": "^7.13.0",
3031
"eslint-config-prettier": "^6.15.0",
3132
"husky": "^4.2.5",
@@ -42,6 +43,7 @@
4243
},
4344
"scripts": {
4445
"build": "tsc -p tsconfig.build.json",
46+
"benchmark": "node ./benchmark/benchmark.js",
4547
"document": "typedoc",
4648
"prepare": "npm run build",
4749
"eslint": "eslint src test",
@@ -62,6 +64,7 @@
6264
"node": true,
6365
"browser": true
6466
},
67+
"ignorePatterns": ["benchmark/*.js"],
6568
"parserOptions": {
6669
"sourceType": "module",
6770
"ecmaFeatures": {

0 commit comments

Comments
 (0)
Please sign in to comment.