Running in the browser with Emscripten LLVM faster than CPython?

Skip to first unread message

Luke Stanley

Mar 18, 2013, 9:32:09 PM3/18/13
Hey guys, thought I would just share an exciting possibility.
Given the speed of the new ASM compiling Javascript engines these days, Mozilla is working on a subset of Javascript generated from C/++ that can be optimised to about half the speed of native C, see:

So the question is: has anyone yet got Shedskin working in the browser with Emscripten or some other LLVM medium? (Translated to Javascript or not?)

Especially curious if anyone has got it working with canvas, even more so if supporting webgl for speed or 3D rendering when it's available.

I couldn't get my friend Alex P-B's PyGame based Fysphun code to work yet by the way (the file in the shedskin at all, but we will be trying more tomorrow).
My little brother is often asking to play with Alex's game so being able to just link him to it would be awesome.

The main thing at the moment seems to be switching to the different garbage collector Emscripten uses (though it says it is mostly compatible with the regular Boehm garbage collector Shedskin uses, it requires setting up and I'm a C++ noob, but will probably have this sorted soon).

Check out some cool demos from other C/++ ports to JS: 

--Luke Stanley

Luke Stanley

Mar 30, 2013, 7:17:49 AM3/30/13
Hey all, a little update;
It doesn't work yet still but I made a script that sets up a virtual machine to run Emscripten and Shedskin with some compilation tests. 
t also runs directly in recent versions of Ubuntu. Both should be fairly easy to run.

Check it out:

It shows the current state: 
Lines 10 and 11 in builtin.hpp of Shedskin's garbage collection headers do not yet exist in Emscripten doesn't have implemented:

If anyone is interested in this, let me know, or do chime in!


Mark Dufour

Apr 28, 2013, 3:58:20 AM4/28/13
to shedskin-discuss
hi luke,

sorry for the late reply. but, that's some nice work there! :)

I just tried to play around a bit, but was unable to quickly get a hello world program to output something (ubuntu 13.04). should that even work..?

do you have a list of quick commands perhaps to get a demo to work under ubuntu, preferrably without the virtualbox stuff? :P

does it look like shedskin works well under LLVM (except for the GC, perhaps)? I'm asking because it's practically only tested with GCC.. even under windows.


You received this message because you are subscribed to the Google Groups "shedskin-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit


Luke Stanley

Apr 28, 2013, 6:45:13 AM4/28/13
Thanks. :)

Actually I the GC problem has been fixed. I haven't seen any LLVM problems. GCC is replaced with calls to emcc. Only a size problem from using Perl regular expressions lib, so that's disabled for Emscripten use for now. 

The setup script should be fairly portable. The Vagrant VM isn't very complicated, it's a basic, almost unaltered 12.10 (I think) image of Ubuntu from Ubuntu's own servers. It runs the bash setup script to add the rest.
Copying and pasting the instructions with VirtualBox might take ~300 MB but it will probably work without much fuss, (do something else while it sets up?) that said, like I say, if you want to run it directly, it won't be too hard! Just look at 
I should add some more if statements to it to cater to the non-VM situation at some point.
I'm working on the cross-platform graphics library for it at the moment.
I need to add the license info to the repro too, will do that shortly.


Phone: +44(0)7453813163
Skype: fluxorz Twitter: @lukestanley
Reply all
Reply to author
0 new messages