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
// This example shows how to compile simple rust hello world program
// into webassembly and run it using wasi runtime.
// This example requires rustc and wasm32-wasi target to be installed.
// I recommend looking at examples/hello_world.rs first as it is
// commented in more detail.
use ;
// If you look closely at the output, you will see that time_taken is less
// than in native runtime. This is because wasm runtime only measures time
// to actually run the code, while native runtime has overhead of
// executing the host command.