Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update benchmark #24

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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