January 10, 2015
On 01/09/2015 10:28 AM, Manu via Digitalmars-d wrote:
> I'm looking at another potential opportunity to get D into the office,
> but the target's for this particular project are NaCL and/or
> Emscripten.
>
> I was gonna start hacking around to see what the limitations are with
> Emscripten on D code tonight. Has anyone done any serious
> investigation here?
>
> NaCl is a more useful target, but I think that will rely on a special
> build of LDC... has there been discussion about that before? Can any
> of the LDC guys chime in on the possibility?
>

It would require some druntime work for the libc differences (newlib vs. glibc). That's similar to the ongoing Android/X86 work https://github.com/D-Programming-Language/druntime/pull/1069.
January 11, 2015
On 11 January 2015 at 01:31, via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> There are also other compilers from C++ to Javascript, Mandreel and Cheerp.
>
> Cheerp claims to support the builtin Javascript garbage collector:
>
> «Dynamic memory management. C++ objects are translated directly to JS objects, without the proxy of an emulated, flat memory space. Allow your applications to exploit the JavaScript VM garbage collector and co-exist with fair, on-demand memory allocation.»
>
> http://www.leaningtech.com/cheerp/blog/
>
> So if Cheerp is ready for production (I don't know if it is), it might be a
> better fit for D.

The thing about cheerp vs emscripten, is that while cheerp produces
code that is more like javascript, emscripten produces asm.js, which
is lightning fast by comparison.
If there's actual work being done, then emscripten is the choice, if
it's just as a substitute for writing js code, because it's a
nightmare, then cheerp is probably better.

January 11, 2015
On Sunday, 11 January 2015 at 01:05:59 UTC, Manu via Digitalmars-d wrote:
> The thing about cheerp vs emscripten, is that while cheerp produces
> code that is more like javascript, emscripten produces asm.js, which
> is lightning fast by comparison.
> If there's actual work being done, then emscripten is the choice, if
> it's just as a substitute for writing js code, because it's a
> nightmare, then cheerp is probably better.

You are probably right about throughput which I would expect to be better with Emscripten than Cheerp, although keep in mind that only Firefox converts asm.js directly to asm without the regular JIT. IE and Chrome uses the regular JIT AFAIK.

With asm.js you are also stuck with a fixed size heap and if you manage to implement GC on asm.js, you get the freeze... Then you have interop with JS. Not sure if you can interact with Worker-threads within asm.js?

I had not heard of Cheerp until today, but it looks interesting to me.

January 14, 2015
On Sunday, 11 January 2015 at 01:33:25 UTC, Ola Fosheim Grøstad wrote:
> On Sunday, 11 January 2015 at 01:05:59 UTC, Manu via Digitalmars-d wrote:
> With asm.js you are also stuck with a fixed size heap

The heap can grow now, see https://github.com/kripken/emscripten/blob/master/ChangeLog.markdown#v1251-1012014

On Friday, 9 January 2015 at 09:51:36 UTC, Ola Fosheim Grøstad wrote:
> Remember that only Firefox support ASM.js.

Chrome runs it pretty fast though, sometimes faster than Firefox.
January 14, 2015
On Wednesday, 14 January 2015 at 03:11:41 UTC, Janus wrote:
> On Sunday, 11 January 2015 at 01:33:25 UTC, Ola Fosheim Grøstad wrote:
>> On Sunday, 11 January 2015 at 01:05:59 UTC, Manu via Digitalmars-d wrote:
>> With asm.js you are also stuck with a fixed size heap
>
> The heap can grow now, see https://github.com/kripken/emscripten/blob/master/ChangeLog.markdown#v1251-1012014
>

Thanks, I've read the source code now. It involves creating a new array, then copying the old array into the new one. And it probably needs the experimental Ecmascript 7 ArrayBuffer.transfer() function to be fast. So clearly something that only can run when waiting for something (like between levels in a game).

> Chrome runs it pretty fast though, sometimes faster than Firefox.

Yes, not if the code is ASM.js, but still good even then.
1 2
Next ›   Last »