mirror of
https://github.com/TecharoHQ/anubis.git
synced 2026-04-11 02:58:49 +00:00
feat(web/wasm): use simd128 if available
Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
9
package-lock.json
generated
9
package-lock.json
generated
@@ -10,7 +10,8 @@
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@aws-crypto/sha256-js": "^5.2.0",
|
||||
"preact": "^10.27.2"
|
||||
"preact": "^10.27.2",
|
||||
"wasm-feature-detect": "^1.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cssnano": "^7.1.1",
|
||||
@@ -2685,6 +2686,12 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/wasm-feature-detect": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/wasm-feature-detect/-/wasm-feature-detect-1.8.0.tgz",
|
||||
"integrity": "sha512-zksaLKM2fVlnB5jQQDqKXXwYHLQUVH9es+5TOOHwGOVJOCeRBCiPjwSg+3tN2AdTCzjgli4jijCH290kXb/zWQ==",
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/wrap-ansi": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@aws-crypto/sha256-js": "^5.2.0",
|
||||
"preact": "^10.27.2"
|
||||
"preact": "^10.27.2",
|
||||
"wasm-feature-detect": "^1.8.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { u } from "../../lib/xeact";
|
||||
import { simd } from "wasm-feature-detect";
|
||||
|
||||
type ProgressCallback = (nonce: number) => void;
|
||||
|
||||
@@ -22,9 +23,13 @@ export default function process(
|
||||
console.debug(options);
|
||||
const { basePrefix, version, algorithm } = options;
|
||||
|
||||
let wasmFeatures = "baseline";
|
||||
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let wasmFeatures = "baseline";
|
||||
|
||||
if (await simd()) {
|
||||
wasmFeatures = "simd128";
|
||||
}
|
||||
|
||||
const module = await fetch(u(`${basePrefix}/.within.website/x/cmd/anubis/static/wasm/${wasmFeatures}/${algorithm}.wasm?cacheBuster=${version}`))
|
||||
.then(x => WebAssembly.compileStreaming(x));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user