demofile-net icon indicating copy to clipboard operation
demofile-net copied to clipboard

Add WebAssembly example

Open in0finite opened this issue 1 year ago • 3 comments

in0finite avatar Jan 15 '24 11:01 in0finite

Just want to say this is great - I had no idea that C# WASM was so simple.

Rather than using the ReadAllAsync method, instead can you change to StartParsing/MoveNext and yield to the web UI every 17ms or so? That way the tab won't freeze up as it's parsing, and you get results live.

Many thanks

saul avatar Jan 16 '24 21:01 saul

Yep, wasm support is quite cool 😎

I guess "live" parsing should be simple to add. Probably a repetitive JS timer which advances demo for 17 ms.

Or you can even go step further and run the parser in Web Worker (ie. a background thread in Web) 😄

Will see tomorrow if I have time to add it.

in0finite avatar Jan 16 '24 23:01 in0finite

It's done.

I constrained it to 20 FPS, because 60 FPS increases processing time a lot. I don't know why, probably Task.Delay() has some overhead, or it's not precise to 1 ms level.

in0finite avatar Jan 17 '24 21:01 in0finite