The compilation for fib uses less than 50 MB on v8 (The total heap size before compiling fib is around 45 MB and no gc is triggered during fib compilation). It means that our object representation uses at least 5X more memory than v8, only on parsing.
I don't think the issue is really one of object size. I would guess that our objects are about as big as theirs by default.
The real issue is probably that we create alot of temporary objects during parsing. Our standard library code, for example, converts strings to char code arrays before processing them. If the parser uses the String functions alot, it may be creating temporary arrays and strings every time it does so, which at the time, we have no way of reclaiming since we have no GC.
V8 probably has standard library code that makes less spurious allocations. Our current library code, particularly the string code, does alot of allocations that could probably be avoided. I think just calling String.prototype.charAt will allocate memory for each call, for example.
If we look more carefully at what string functions the parser uses, and optimize those, we may be able to get farther in the compilation. If there are about 650 MB of allocations to initialize the standard library while running in V8, though, that's a little steep to run without a GC, but still possible.
- Maxime