Skip to content

Commit

Permalink
perf: use consts for testing browser support
Browse files Browse the repository at this point in the history
chore: update deps...
  • Loading branch information
okikio committed Dec 25, 2022
1 parent e7577c5 commit e8f783a
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 79 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"deno.enablePaths": [
"./repl.ts",
"./benchmark/deno.ts",
"./benchmark/utils.ts",
"./benchmark/deno.utils.ts",
"./benchmark/deno.worker.ts",
"./benchmark/workers/deno.ts",
"./benchmark/deno.messagechannel.ts",
"./benchmark/deno.messagechannel.ts"
],
"deno.unstable": true
}
4 changes: 2 additions & 2 deletions benchmark/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ export function printTable(variants: string[], dmeanstdev: any, markdownTable: a
const [mean, std] = dmeanstdev(durations.length, 0, new Float64Array(durations), 1, new Float64Array(2), 1);

obj[name] ??= [];
obj[name].push(durations.length == 0 ? `null` : `${timeFormat(mean)} ± ${timeFormat(std).replace("in ", "")}`);
obj[name].push(durations.length === 0 ? `null` : `${timeFormat(mean)} ± ${timeFormat(std).replace("in ", "")}`);

});

Expand Down Expand Up @@ -467,7 +467,7 @@ function getBrowser() {
(verOffset = nAgt.lastIndexOf('/'))) {
browserName = nAgt.substring(nameOffset, verOffset);
fullVersion = nAgt.substring(verOffset + 1);
if (browserName.toLowerCase() == browserName.toUpperCase()) {
if (browserName.toLowerCase() === browserName.toUpperCase()) {
browserName = navigator.appName;
}
}
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,26 +146,26 @@
"devDependencies": {
"@commitlint/cli": "^17.3.0",
"@commitlint/config-conventional": "^17.3.0",
"@playwright/test": "^1.29.0",
"@playwright/test": "^1.29.1",
"@semantic-release/changelog": "^6.0.2",
"@semantic-release/git": "^10.0.1",
"@stdlib/stats-base": "^0.0.7",
"@types/node": "^18.11.17",
"@types/offscreencanvas": "^2019.7.0",
"@types/web": "^0.0.85",
"@types/web": "^0.0.86",
"comlink": "^4.3.1",
"happy-dom": "^8.1.0",
"happy-dom": "^8.1.1",
"husky": "^8.0.2",
"markdown-table": "^3.0.3",
"micromark": "^3.1.0",
"micromark-extension-gfm": "^2.0.1",
"pnpm": "^7.18.2",
"pnpm": "^7.19.0",
"pretty-bytes": "^6.0.0",
"semantic-release": "^19.0.5",
"typescript": "^4.9.4",
"ultra-runner": "^3.10.5",
"vite": "^4.0.2",
"vite": "^4.0.3",
"vite-plugin-dts": "^1.7.1",
"vitest": "^0.26.0"
"vitest": "^0.26.2"
}
}
109 changes: 55 additions & 54 deletions pnpm-lock.yaml

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

13 changes: 13 additions & 0 deletions repl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { MB, generateObj, maxSize, isClonable } from "./benchmark/utils.ts";
import { getTransferable, getTransferables, hasTransferables } from "./src/index.ts";

// import { prettyBytes as bytes } from "https://deno.land/x/pretty_bytes@v2.0.0/mod.ts";

const num = Math.pow(2, Math.log2(maxSize * MB));
const obj = generateObj(num / MB, isClonable);

console.time("Benchmark");

getTransferables(obj, isClonable.streams);

console.timeEnd("Benchmark");

0 comments on commit e8f783a

Please sign in to comment.