-
Notifications
You must be signed in to change notification settings - Fork 121
Open
Description
`
walt:
export function SUM(n: i32): i32 {
let sum: i32 = 0;
let i: i32 = 0;
while(i < n) {
sum = sum + i;
i = i + 1;
}
return sum;
}
SUMWalt().then(wasmModule => {
const begin = Date.now()
console.log('wasm begin: ', begin)
console.log('wasm:', wasmModule.instance.exports.SUM(999999999)) // 1
console.log('wasm end: ', Date.now() - begin)
})
js:
function SUM(n) {
let sum = 0;
let i = 0;
while(i < n) {
sum = sum + i;
i++;
}
return sum;
}
const begin = Date.now()
console.log('js begin: ', begin)
console.log('js: ', SUM(999999999)) // 1
console.log('js end: ', Date.now() - begin)
`
result:
the SUM funtion return value is not the same, and the wasm time more than js time.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
