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