Skip to content

Commit

Permalink
benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinEberhardt committed Jan 28, 2021
1 parent 6847db1 commit 12753db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion benchmark/benchmark.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
global.TextDecoder = require("text-encoding").TextDecoder;
const fs = require("fs");
const loader = require("@assemblyscript/loader/umd/index");
const loader = require("@assemblyscript/loader");

const Benchmark = require("benchmark");
const suite = new Benchmark.Suite();
Expand Down Expand Up @@ -62,6 +62,12 @@ suite
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
executeRegex("[a-l]{3}", text, true);
})
.add("complex regex", () => {
executeRegex(
"M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]",
"Muammar Qadhafi"
);
})
// add listeners
.on("cycle", (event) => {
console.log(String(event.target));
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"description": "A regex engine built with AssemblyScript",
"ascMain": "assembly/index.ts",
"scripts": {
"test": "npm run asbuild:untouched && npm run test:generate && npm run prettier:check && jest __tests__ --reporter=jest-summary-reporter",
"test": "npm run asbuild:untouched && npm run test:generate && npm run prettier:check && npm run test:jest && npm run benchmark",
"test:generate": "node __spec_tests__/test-generator.js",
"jest": "jest __tests__",
"test:jest": "jest __tests__ --reporter=jest-summary-reporter",
"prettier:check": "prettier --check .",
"prettier:write": "prettier --write .",
"asbuild:untouched": "asc assembly/index.ts --target debug",
Expand Down

0 comments on commit 12753db

Please sign in to comment.