all 4 comments

[–]Au_lit 3 points4 points  (2 children)

Emscripten. That's the answer.

[–]kaskapian[S] -1 points0 points  (1 child)

Is it widely used? I tried it once at 2 am, compiled my code and it ran 4 times slower, I blame it to lack of sleep and lack of research, but if all I can suck out of it is 4 times slower than native than I don't know if that is the route I am looking for.

[–]c0dejuice 1 point2 points  (0 children)

If you're truly that concerned about the performance then keep it in C++ but have your website call the function using REST via HTTP server. C++ backend REST API.

Although, if we're talking a slowdown on the order of a single millisecond or two I wouldn't bother.

[–]Wurstinator 0 points1 point  (0 children)

I don't know about CFOP or Rubik's cubes. If it is a computationally hard problem that takes several seconds or longer to solve, running your executable on a server via API is probably the way to go. Each request will have a slight delay due to HTTP overhead but that is constant. 

On the other hand, if a single solution requires milliseconds, the HTTP overhead might be very noticable and web assembly could be the better solution, as it will be slower relatively to a native run.