optimize Ruby memory usage by avoiding string accumulation


/ Published in: Ruby
Save to your folder(s)



Copy this code and paste it in your HTML
  1. "The lessons here are:
  2.  
  3. 1. Temporary strings and temporary objects will stockpile. Just because you leave a method doesn't mean they are gone....
  4. 2. Arrays, hashes, objects are memory cheap. Worry about your strings. Do you have string corpses everywhere?
  5. 3. Build your object from all the pieces, avoiding temporary objects as much as possible. Then, when you're done with it, toss the big object out of scope at once!"

URL: http://whytheluckystiff.net/articles/theFullyUpturnedBin.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.