-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use the latest tlsn@8b163540 with patch * Update rust-toolchain forcing nightly * lint --------- Co-authored-by: Ryan MacArthur <[email protected]>
- Loading branch information
Showing
4 changed files
with
97 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
[toolchain] | ||
channel = "nightly-2022-12-12" | ||
# channel = "nightly-2022-12-12" | ||
# channel = "stable" | ||
# channel = "nightly-x86_64-apple-darwin" | ||
channel = "nightly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import * as Comlink from 'comlink'; | ||
// import init, { prover } from "./pkg/tlsn_extension_rs"; | ||
import init, { initThreadPool, prover } from './pkg/tlsn_extension_rs'; | ||
|
||
function hasSharedMemory() { | ||
const hasSharedArrayBuffer = 'SharedArrayBuffer' in global; | ||
const notCrossOriginIsolated = global.crossOriginIsolated === false; | ||
|
||
return hasSharedArrayBuffer && !notCrossOriginIsolated; | ||
} | ||
|
||
const DATA = Array(20).fill(1); | ||
|
||
class Test { | ||
constructor() { | ||
console.log('!@# test comlink'); | ||
this.test(); | ||
} | ||
|
||
async test() { | ||
console.log('start'); | ||
console.log('!@# hasSharedMemory=', hasSharedMemory()); | ||
const numConcurrency = navigator.hardwareConcurrency; | ||
console.log('!@# numConcurrency=', numConcurrency); | ||
const res = await init(); | ||
console.log('!@# res.memory=', res.memory); | ||
// 6422528 ~= 6.12 mb | ||
console.log('!@# res.memory.buffer.length=', res.memory.buffer.byteLength); | ||
await initThreadPool(numConcurrency); | ||
const resProver = await prover(); | ||
console.log('!@# resProver=', resProver); | ||
console.log('!@# resAfter.memory=', res.memory); | ||
// 1105920000 ~= 1.03 gb | ||
console.log( | ||
'!@# resAfter.memory.buffer.length=', | ||
res.memory.buffer.byteLength, | ||
); | ||
} | ||
} | ||
|
||
Comlink.expose(Test); |