erlang_js is awesome. But I started refactoring. Now there's emonk.
With the latest versions of Emonk there's quite a bit of difference now. Emonk is NIF based and uses a thread-pool to move JavaScript execution off of the Erlang scheduler threads. Translation from Erlang terms to JavaScript objects uses a native translation step to avoid JSON overhead. I haven't gotten around to actually testing to see if there's any sort of appreciable difference in speed.
- A fairly recent version of Spidermonkey. I use the version from HomeBrew which uses this url.
- R14A. Emonk uses the new NIF API extensively.
Hopefully the build scenario is something like:
$ git clone git://github.com/davisp/emonk.git
$ cd emonk
$ make
$ make check
I've been using etap to test as I code. Its awesome. You should use it. That said, running is pretty cake assuming emonk is on your Erlang code path:
$ ERL_LIBS=~/awesome_projects/emonk/src erl -s emonk
1> {ok, Context} = emonk:create_ctx().
{ok, <<>>} % Note: The <<>> here is *not* an empty binary. Its a resource.
2> emonk:eval(Context, <<"var f = 2; f*3;">>).
{ok, 6}
3> emonk:eval(Context, <<"var g = function(x) {return x*4;};">>).
{ok, undefined}
4> emonk:call(Context, <<"g">>, [9]).
{ok, 36}
The best place to file bugs is at the issue tracker on GitHub. Less yapping, more tapping. Thanks mattly.
That's pretty much it. Mostly this was internal churn that I kinda started chasing around like my tail. Hopefully things are easy enough to follow in the logs and code.