{"id":316,"date":"2009-05-29T01:11:30","date_gmt":"2009-05-29T06:11:30","guid":{"rendered":"http:\/\/vgable.com\/blog\/2009\/05\/29\/dont-waste-memory-to-save-time\/"},"modified":"2009-05-29T03:07:06","modified_gmt":"2009-05-29T08:07:06","slug":"dont-waste-memory-to-save-time","status":"publish","type":"post","link":"https:\/\/vgable.com\/blog\/2009\/05\/29\/dont-waste-memory-to-save-time\/","title":{"rendered":"Don&#8217;t Waste Memory to Save Time"},"content":{"rendered":"<p>In the provocatively titled, <a href=\"http:\/\/www.sealiesoftware.com\/blog\/archive\/2008\/10\/14\/Space_is_time_how_your_CS_theory_class_lied_to_you.html\"><cite>Space is Time: How Your CS Theory Class Lied to You<\/cite><\/a>, Greg Parker explains why hogging memory to speed up your program is a bad idea on consumer-level devices.<\/p>\n<blockquote><p>Space <em>is<\/em> time. An optimization that makes <em>your program <\/em> faster may make <em>the user&#8217;s system slower overall<\/em>. Play well with others.\n<\/p><\/blockquote>\n<p>I think it&#8217;s excellent advice. There&#8217;s only one point I want to make (and it must be made now, before silent <a href=\"http:\/\/anandtech.com\/storage\/showdoc.aspx?i=3531&#038;p=1\">SSD hard disks<\/a> become more popular).<\/p>\n<p><strong>Every time your <em>whole computer<\/em> is nonresponsive, it makes that grrnrrnrnrr sound, right?<\/strong> That&#8217;s because it ran out of RAM, and the virtual memory system is <a href=\"http:\/\/en.wikipedia.org\/wiki\/Thrash_(computer_science)\">thrashing<\/a> to the disk. In the real word, on computers like the one you are on now, low memory plays a part in <em>every<\/em> system-wide slowdown.<\/p>\n<p>Hogging the CPU can make your <em>application<\/em> slow. (Although if you pay attention to threading, and <a href=\"http:\/\/www.cocoadev.com\/index.pl?RunLoop\">the run loop<\/a>, using 100% of every core shouldn&#8217;t kill <a href=\"http:\/\/vgable.com\/blog\/2009\/04\/30\/acceptable-delays\/\">responsiveness and usability<\/a>.)  But hogging memory makes <em>the whole damn world<\/em> slow, including your application. And <a href=\"http:\/\/wilshipley.com\/blog\/2008\/07\/pimp-my-code-part-15-greatest-bug-of.html\">the worst case scenario of bad memory management kills the system deader then a kernel panic<\/a>.<\/p>\n<p>This isn&#8217;t to say that caching never makes sense. But a healthy respect for memory usage generally trumps worrying about the CPU.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the provocatively titled, Space is Time: How Your CS Theory Class Lied to You, Greg Parker explains why hogging memory to speed up your program is a bad idea on consumer-level devices. Space is time. An optimization that makes your program faster may make the user&#8217;s system slower overall. Play well with others. I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[203,3,4,8],"tags":[429,428,158,427],"class_list":["post-316","post","type-post","status-publish","format-standard","hentry","category-iphone","category-macosx","category-programming","category-usability","tag-hard-drives","tag-hardware","tag-optimization","tag-virtual-memory"],"_links":{"self":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/316","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/comments?post=316"}],"version-history":[{"count":0,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/316\/revisions"}],"wp:attachment":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/media?parent=316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/categories?post=316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/tags?post=316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}