-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
55 lines (51 loc) · 2.05 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="shortcut icon" href="./public/favicon.ico" type="image/x-icon">
<title>WebAssembly</title>
</head>
<body>
<div id="app"></div>
<script>
const fpPromise = import('https://fpjscdn.net/v3/d4jZTTYGvR9ADj4pVcj4')
.then(fpJs => fpJs.load({
apiKey: "d4jZTTYGvR9ADj4pVcj4",
endpoint: "https://www.renshuai.asia",
scriptUrlPattern: "https://www.renshuai.asia/web/v<version>/<apiKey>/loader_v<loaderVersion>.js"
}))
fpPromise
.then(fp => fp.get())
.then(result => {
const visitorId = result.visitorId
console.log("🚀🚀🚀 ----------------------------------🚀🚀🚀");
console.log("🚀🚀🚀 visitorId🚀🚀🚀", visitorId);
console.log("🚀🚀🚀 ----------------------------------🚀🚀🚀");
})
</script>
<script src="./fibonacci/fibonacci.js"></script>
<script>
// Load the WebAssembly module
Module.onRuntimeInitialized = function() {
function fibonacciJs(n) {
if(n<=1) {
return n
}
return fibonacciJs(n-1) + fibonacciJs(n-2)
}
const num = 40;
const startCpp = performance.now()
const resultCpp = Module._fibonacci(num);
const endCpp = performance.now()
const startJs = performance.now()
const resultJs = fibonacciJs(num);
const endJs = performance.now()
console.log("🚀🚀🚀 ----------------------------🚀🚀🚀");
console.log("🚀🚀🚀 resultCpp🚀🚀🚀", `${resultCpp}:${endCpp-startCpp}`);
console.log("🚀🚀🚀 resultJs🚀🚀🚀", `${resultJs}:${endJs-startJs}`);
console.log("🚀🚀🚀 ----------------------------🚀🚀🚀");
};
</script>
</body>
</html>