https://github.com/kant2002/nativeaotwasi
WASI tests for NativeAOT-LLVM
https://github.com/kant2002/nativeaotwasi
Last synced: over 1 year ago
JSON representation
WASI tests for NativeAOT-LLVM
- Host: GitHub
- URL: https://github.com/kant2002/nativeaotwasi
- Owner: kant2002
- License: mit
- Created: 2023-06-01T19:59:49.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-01T21:10:25.000Z (about 3 years ago)
- Last Synced: 2024-10-11T20:37:53.372Z (almost 2 years ago)
- Language: C#
- Size: 11.7 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# NativeAOT WASI
You need to set `EMSDK` and `WASI_SDK_PATH` env variables.
# LRU
Build test
```
dotnet publish lru -c Release /p:TargetArchitecture=wasm /p:PlatformTarget=AnyCPU --self-contained /p:IsWasiProject=true
dotnet publish lru -c Release /p:TargetArchitecture=wasm /p:PlatformTarget=AnyCPU --self-contained /p:IsWasiProject=false
```
Run tests
```
date ; wasmtime --dir artifacts\bin\lru\release_wasi-wasm\AppBundle artifacts\bin\lru\release_wasi-wasm\AppBundle\lru.wasm --mapdir .::. -- 100 10000000 ; date
date ; wasmtime --wasm-features=threads --wasi-modules=experimental-wasi-threads --dir artifacts\publish\lru\release_wasi-wasm\ artifacts\publish\lru\release_wasi-wasm\lru.wasm --mapdir .::. -- 100 10000000 ; date
```
Results
## NativeAOT-LLVM - 3 seconds
```
> date ; wasmtime --wasm-features=threads --wasi-modules=experimental-wasi-threads --dir artifacts\publish\lru\release_wasi-wasm\ artifacts\publish\lru\release_wasi-wasm\lru.wasm --mapdir .::. -- 100 10000000 ; date
Fri, Jun 2, 2023 2:19:29 AM
969216
9030784
Fri, Jun 2, 2023 2:19:32 AM
```
## WASI SDK - 55 seconds
```
> date ; wasmtime --dir artifacts\bin\lru\release_wasi-wasm\AppBundle artifacts\bin\lru\release_wasi-wasm\AppBundle\lru.wasm --mapdir .::. -- 100 10000000 ; date
Fri, Jun 2, 2023 2:19:38 AM
969216
9030784
Fri, Jun 2, 2023 2:20:33 AM
```
# Parsing 100 Kb JSON
```
curl https://raw.githubusercontent.com/json-iterator/test-data/master/large-file.json -O large-file.json
curl https://raw.githubusercontent.com/nshntarora/Indian-Cities-JSON/master/cities-name-list.json -O cities-name-list.json
curl https://raw.githubusercontent.com/nshntarora/Indian-Cities-JSON/master/a-detailed-version.json -O a-detailed-version.json
curl https://raw.githubusercontent.com/nshntarora/Indian-Cities-JSON/master/cities.json -O cities.json
```
Build test
```
dotnet publish json -c Release /p:TargetArchitecture=wasm /p:PlatformTarget=AnyCPU --self-contained /p:IsWasiProject=true
dotnet publish json -c Release /p:TargetArchitecture=wasm /p:PlatformTarget=AnyCPU --self-contained /p:IsWasiProject=false
```
Run tests
```
date ; wasmtime --dir artifacts\bin\json\release_wasi-wasm\AppBundle artifacts\bin\json\release_wasi-wasm\AppBundle\json.wasm --mapdir .::. -- large-file.json ; date
date ; wasmtime --wasm-features=threads --wasi-modules=experimental-wasi-threads --dir artifacts\publish\json\release_wasi-wasm\ artifacts\publish\json\release_wasi-wasm\json.wasm --mapdir .::. -- large-file.json ; date
```
Results
## NativeAOT-LLVM - 1 ms
```
> wasmtime --wasm-features=threads --wasi-modules=experimental-wasi-threads --dir artifacts\publish\json\release_wasi-wasm\ artifacts\publish\json\release_wasi-wasm\json.wasm --mapdir .::. -- cities.json
1221 objects read at 00:00:00.0014680
```
## WASI SDK - 118 ms
```
> wasmtime --dir artifacts\bin\json\release_wasi-wasm\AppBundle artifacts\bin\json\release_wasi-wasm\AppBundle\json.wasm --mapdir .::. -- .\cities.json
1221 objects read at 00:00:00.1182920
```