Improved javascript allocations