So I did some timings with H2D2 (which is written in C) versus my original proof of concept, DALIS, which was written in C#. It isn't a comparison of the speed of C programs compared to .Net ones, because H2D2 is written totally differently - there's no parsing of source code going on when I'm running my H2D2 code for example. So I'm not trying to prove the .Net framework is slow, I'm just trying to compare DALIS with its offspring. Plus I've been more careful writing H2D2 because I have already proved the theory, this time I'd like to take my time, so the code is hopefully more efficient.
Having said that, I know that I could further optimise H2D2 if I wanted to. I've already gotten a few ideas to make loops faster, and there's still some debugging code that I could remove yet.
But I was shocked when I used my Mandelbrot set drawing program as a benchmark. Running DALIS from the command line, it took 11.8 seconds to draw the ASCII Mandelbrot set. Doing exactly the same thing in H2D2 took just 650 milliseconds. Wow. That's a big difference. It was worth the rewrite.
What I'd like to do now is take a single H2D2 program - one that I have compiled to bytecode - and run it for a timeslice on Windows and then execute the remainder of the program on Linux. I would like to prove that will work. Even better if I can do it on the Raspberry Pi... because then it will demonstrate different OSes and different processor types. Let's see what happens...
I don't know if there are many practical uses for sharing programs between devices and operating systems whilst they're actually being executed, but it seems like a neat trick anyway.