The microScript language is currently interpreted in JavaScript. The performance is ok but will show some limits when you are trying to perform intensive physics calculations for example or rendering a huge number of moving objects. To improve that, I have started working on a microScript to JavaScript transpiler which I expect to be ready soon. It should bring very significant performance improvements to the engine.

The transpiler is now almost working. I still have bugs when running some projects with it (especially, it seems to have problems running Quick Engine). However I will make it available soon, in its current alpha status (as an option), so that you can check it if you want to.

I was able to run some early performance tests:

  • Raytracing demo by @this_name_is_taken: I am getting a 4x performance boost (40000 rays per second vs 10000 rays per second when interpreted)
  • My chess computer AI: 6x performance boost

Sounds great :) can't wait to tease it, haha.

Reminds me, try this one:


Never finished it ... because the speed sucks, LOL

Thanks @TinkerSmith I will look into it!

Wow, this would be great! Exactly what I was about to ask after releasing my raymarcher :).

I'm also quite curious to how intense rendering programs like raymarching and raytracing would work. Would realtime raytracing be possible...?

Edit: Just noticed the test on my raytracer - haha - a four times rendering boost is massive! I have a few projects I have that I haven't been able to release (first-person procedurally generated world, realtime raytracer) because of speed limitations. Honestly can't wait for this to come out, hopefully in time for my incoming raymarcher as well.

Also, I just found an interesting scratch feature that speeds up scratch projects by compiling them into javascript - https://turbowarp.org/ if that helps.

The transpiler is there! To activate it, open the console options and check "Use the transpiler". Then you need to relaunch your project.

Some projects will not work at all. Many projects should work though, and when they do, they should show a significant improvement in performance.

If you have publicly available projects that does not run with the transpiler, please notify me, it may help me find the remaining bugs.

To run your project full window with the transpiler, just add #transpiler to the URL, like this: https://microstudio.io/this_name_is_taken/3dplatformer/#transpiler

Ok. Wow. I used this on my raytracer in the console, and it was definitely much faster. But when I ran it in the full screen window it showed no difference in performance...?

I presume it makes no difference in embedded projects at the moment (see below).

:embed https://microstudio.io/this_name_is_taken/raytracerv1/#transpiler

:embed https://microstudio.io/this_name_is_taken/raytracerv1/

And also, the 3d platformer is definitely showing speed improvements. Time to put the transpiler link in the description ;)

Edit: Just tried this on my raymarcher. My raymarcher (which was slightly lagging at 5 samples per frame) now starts slightly lagging at 20 samples per frame. A signficant improvement!

(without transpiler)

:embed https://microstudio.io/this_name_is_taken/raymarcher/FHJE9D3D/

(with transpiler) https://microstudio.io/this_name_is_taken/raymarcher/FHJE9D3D/#transpiler

I noticed the same. The editor preview runs faster, but in full screen mode it seems to be running at it's 'old' speed.


Edit: ... weird ... seems to be running faster on Chrome browser? Definitely slower on Firefox. Have to look into this.

@this_name_is_taken, I would like to suggest that you make the following change in your ray tracer:

update = function()
  local exit_time = system.time()+16
  while system.time()<exit_time

This way you are ensuring to use all the computing time you have available, without overstressing the CPU. This would best let us appreciate how efficient it is, with or without the transpiler. This is how I benchmarked it on my side. Possible bonus feature: count the number of samples tested and the elapsed time and display the average number of rays per second :-)

Sounds great! That would work perfectly, thanks :).

I can use that in my raymarcher as well!

Edit: Done! Seems to be working well :)

I noticed that if the secret URL is #transpiler the project doesn't load while it isn't public.

Post a reply



Validate your e-mail address to participate in the community