Ah haha. I love this conversation of trying to find a product market fit in public.
What if the input to the JavaScript (mermaid in this case) is not trusted to run on the end client machines but by running untrusted input on a sandbox (this service, or self hosted idk) is somehow acceptable and the output a blob of an image is acceptable to display on the actual client machines.
Takes the planets to align just right and need us to squint just enough but I think we can find something if we look hard enough.
But then mermaid can simply output PNG so you could run it as a worker... Thinking...
It was funny that when I was in the middle of the project, I discovered Hurl. It was cool, especially since it's written in Rust and uses libcurl under the hood. However, the lack of OpenAPI support and VS Code integration forced me to continue working on HTTL project.
To really see how these algorithms perform, you should compare the worst case for the algorithm. In order to see if a picture is identical, you’d have to loop through every single pixel, which is the worst case. But you can shortcut on the first pixel which is different, which I imagine happens pretty quickly on many generic pictures. So testing performance with two different images is probably not best for comparison.
You can only short-circuit if you’re returning a Boolean. If you need to do what these tools and return some metric for the degree of difference you still have to process both images in entirety.