[erlang-questions] Erlang in the browser

Björn-Egil Dahlberg <>
Tue Jan 31 14:46:36 CET 2012


On 2012-01-31 11:56, Fredrik Svahn wrote:
> The Erlang list [1, 2, 3] is represented as js native objects {value:
> 1, next: {value: 2, next: {value: 3, next:nil}}}. The size of a string
> represented as a list is 40 bytes per character in Chromium on my
> x86_64 machine (I do not know if the size would be smaller on a 32 bit
> machine). The corresponding number for beam is 16 bytes/char for
> x86_64, I believe, so it is more wasteful as expected. I have
> considered mapping it to js arrays but haven't done any measurements.
> This is just a small script so I did not want to write my own GC, also
> mapping to native objects is better if I later would like to make it
> possible to compile performance critical beams to native javascript
> code.

Very cool project Fredrik. You obviously have too much time on your 
hands right now =)

Btw, If memory is a problem, wouldn't it be better to represent lists as 
some sort of (Phil Bagwell) VLists? I guess you have already thought 
about it since you did measurements on it before for erlang.

// Björn-Egil



More information about the erlang-questions mailing list