gemweight.rb is a script to calculate the memory use and load time of a given gem. This is a pretty off-the-cuff measure - it doesn’t consider dependencies loaded (or not loaded, if the gem loads them on demand). But I thought it was mildly interesting nonetheless. Results for some common gems:
| activerecord | 26MB | 0.53s |
| dm-core | 20MB | 0.28s |
| sequel | 14MB | 0.22s |
| activesupport | 21MB | 0.40s |
| sinatra | 13MB | 0.21s |
| rush | 756k | 0.03s |
| erb | 252k | 0.00s |
| erubis | 12MB | 0.17s |
| haml | 12MB | 0.17s |
| activeresource | 25MB | 0.45s |
| rest_client | 13MB | 0.19s |
| httparty | 14MB | 0.19s |
| json | 11MB | 0.17s |
| xmlsimple | 13MB | 0.19s |
| hpricot | 13MB | 0.21s |
The script:
Only works on Linux, I couldn’t figure out any way to compute free memory from the command line on OS X.