[wasm] Add console version of browser-bench sample (#60733)
authorRadek Doulik <radek.doulik@gmail.com>
Mon, 8 Nov 2021 08:58:06 +0000 (09:58 +0100)
committerGitHub <noreply@github.com>
Mon, 8 Nov 2021 08:58:06 +0000 (09:58 +0100)
commita8ac67ae5373dce4d337012d2e8c875d32ffa638
tree61cae5ab2460c36c93b489443c928b23fe5103da
parent70dd2db7489bf6069c0f1d9361f3e144fe7c7999
[wasm] Add console version of browser-bench sample (#60733)

* [wasm] Add console version of browser-bench sample

Example run:

    > v8 --expose_wasm runtime.js --  --run  Wasm.Console.Bench.Sample.dll -t Json:non,Exceptions:Inline
    console.info: Arguments: --run,Wasm.Console.Bench.Sample.dll,-t,Json:non,Exceptions:Inline
    console.debug: MONO_WASM: Initializing mono runtime
    console.debug: MONO_WASM: ICU data archive(s) loaded, disabling invariant mode
    console.debug: mono_wasm_runtime_ready fe00e07a-5519-4dfe-b35a-f867dbaf2e28
    console.info: Initializing.....
    Benchmark started
    Json, non-ASCII text serialize count: 23, per call: 7.565217391304348ms, total: 0.174s
    ...
    Exceptions, TryCatchFilterInline count: 1766666, per call: 4.301888415806949E-05ms, total: 0.076s

    Summary
    Json, non-ASCII text serialize: 7.478260869565218ms
    Json, non-ASCII text deserialize: 10.789473684210526ms
    Exceptions, TryCatchFilterInline: 4.301888415806949E-05ms

    .md
    | measurement | time |
    |-:|-:|
    |         Json, non-ASCII text serialize |     7.4783ms |
    |       Json, non-ASCII text deserialize |    10.7895ms |
    |       Exceptions, TryCatchFilterInline |     0.0430us |

* Don't generate v8 script for browser project

* Fix option set

* Changes for linux/mac

* Add link to bench sample README

* Pass ARGS to the console version

Add info about filtering and options to the README

* Show how the table will looks like

* Do not sign the assembly

To avoid

    CSC : error CS8002: Referenced assembly 'Mono.Options, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name.

* Add examples how to run it on windows

* Fix interpolated string

* Improve formatting

* Remove unwanted space
15 files changed:
src/mono/sample/wasm/Directory.Build.targets
src/mono/sample/wasm/browser-bench/BenchTask.cs
src/mono/sample/wasm/browser-bench/Browser.cs [new file with mode: 0644]
src/mono/sample/wasm/browser-bench/Console/Console.cs [new file with mode: 0644]
src/mono/sample/wasm/browser-bench/Console/Makefile [new file with mode: 0644]
src/mono/sample/wasm/browser-bench/Console/Wasm.Console.Bench.Sample.csproj [new file with mode: 0644]
src/mono/sample/wasm/browser-bench/Program.cs
src/mono/sample/wasm/browser-bench/README.md [new file with mode: 0644]
src/mono/sample/wasm/browser-bench/Wasm.Browser.Bench.Sample.csproj
src/mono/sample/wasm/browser-bench/WebSocket.cs
src/mono/sample/wasm/browser-bench/index.html
src/mono/sample/wasm/console/Makefile
src/mono/sample/wasm/console/Wasm.Console.Sample.csproj
src/mono/sample/wasm/wasm.mk
src/mono/wasm/README.md