Reducing Typo's memory footprint

Posted by Tim Connor Sat, 14 Apr 2007 05:07:00 GMT

While properly setting up my Rails app server maintenance tasks, I noticed that my Typo install was running even more bloated than I remembered – no wonder the Dreamhost watcher processes kill it off. After digging around and trying a couple things it seemed that deleting your unused text-filters, sidebars, and plugins does nicely, for trimming down Typo.

Well, I got my Typo install down from running in the 50s to 30s (megs)upon the initial start (it still grows as it leaks, of course). See the glory of what I hacked out of the vendor folder.

!      vendor/bluecloth
!      vendor/plugins/magnolia_sidebar
!      vendor/plugins/haml
!      vendor/plugins/aimpresence_sidebar
!      vendor/plugins/fortythree_sidebar
!      vendor/plugins/technorati_sidebar
!      vendor/plugins/typo_textfilter_tmcode
!      vendor/plugins/tada_sidebar
!      vendor/plugins/typo_textfilter_lightbox
!      vendor/plugins/typo_textfilter_markdown
!      vendor/plugins/tiny_mce
!      vendor/plugins/xbox_sidebar
!      vendor/plugins/typo_textfilter_amazon
!      vendor/plugins/typo_textfilter_sparkline
!      vendor/plugins/amazon_sidebar
!      vendor/plugins/recent_comments_sidebar
!      vendor/plugins/typo_textfilter_textile_and_markdown
!      vendor/plugins/audioscrobbler_sidebar
!      vendor/plugins/backpack_sidebar
!      vendor/plugins/xml_sidebar
!      vendor/plugins/typo_textfilter_flickr
!      vendor/plugins/typo_textfilter_code
!      vendor/plugins/flickr_sidebar
!      vendor/plugins/typo_textfilter_smartypants
!      vendor/plugins/upcoming_sidebar
!      vendor/plugins/sitealizer
!      vendor/plugins/fortythreeplaces_sidebar
!      vendor/rubypants
!      vendor/flickr
!      vendor/jabber4r
!      vendor/sparklines

Here are the corresponding environment.rb changes. I also deleted all but the Textile and none filters in the admin interface. The first thing I tried chopping out, though, was the newly added sitealizer. Since this is run via an around filter, you have to edit your application.rb thusly, if you take it that far. I, also, got carried away and took out BlueCloth, since Textile is handled by RedCloth. In doing so, I found at least one place in the admin interface were it is hard-coded, and will cause your new content form to choke: app/views/admin/content/_form.rhtml

UPDATE – five minutes later: I forgot, I also turned off live Preview to stop hammering my poor app, and started editing directly in Textmate, from the textarea

UPDATE – 4/19/2007 – Found another hard-coded instance of BlueCloth that I had to comment out: app/models/text_filter.rb/comment_help line 96

f.help_text.blank? ? '' : help_text  # "#{BlueCloth.new(f.help_text).to_html}\n" 
Comment form

(leave url/email »)

Help with Textile (code)