Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Very cool, detailed slides.

I think his notes demonstrate how wildly the 'optimal' settings for a scripting runtime can vary based on use case - 500K slots in a slab makes perfect sense for rails, but 10K also makes pretty good sense for running ruby from the command line to execute a tiny script.

One thing that caught my eye - I think according to slide 52, at startup a rails app is using over 3625840 bytes of heap just to represent newline nodes generated from source code? Am I interpreting the data right, or is he just counting the actual nodes and not the RVALUEs attached to them? Kind of funny to think about optimizing memory usage in a rails app by stripping out superfluous newlines.



You're right, there's about 90k NEWLINE nodes on the heap, and at 40 bytes a piece that's taking up about 3.6mb of slots on the heap that could be used by other ruby objects instead.

Unfortunately, removing newlines from your codebase will not help since NODE_NEWLINE is used for separators like semicolons as well.

Ruby 1.9 gets rid of NODE_NEWLINE altogether by adding a NEWLINE flag to the next node instead. A similar patch will be in the next release of REE.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: