In my previous post I had left open a problem of a 100ms delay that forced the screen to repaint.
I've been working out what is required to make sure the screen paints between each assignment of a new Base64 to the <img>
tag in the DOM.
After some discussion in Discord with Marek FiĊĦera, I've gotten the "forced delay" down to a single millisecond:
private async Task DrawStar()
{
using (Image<Rgba32> image = new(TimesCompleted * 10, 200))
{
Star star = new(x: 100.0f, y: 100.0f, prongs: 5, innerRadii: 20.0f, outerRadii: 30.0f);
image.Mutate(x => x.Fill(Color.Red, star));
ImgString = image.ToBase64String(JpegFormat.Instance);
}
TimesCompleted++;
StateHasChanged();
await Task.Delay(1);
await Task.Yield();
}
As a result, I get a more accurate picture of JIT vs AOT compilation for this little test case.
JIT: