On OS X, when I open a project, switching focus to another application and returning to TextMate.app causes the pizza wheel to appear and TextMate.app takes 10-20 seconds before it responds.
On coming back to work last week, I thought it’d be a good idea to update my local database copy and image farm. As it’s a dev copy there is no need to update this regularly and so I don’t, but it seemed like a good thing to do at the begining of a new year.
It however transpired that between my previous update a month ago and last week, we ‘d quadrupled our userbase (which beggars the question - “was I sleeping while this was happening?”). Anyhoo, 30k more users added a minimum of 60k more files to the project directory - image files in this case.
Shortly after this update, the problem stated above appeared and no amount of tinkering and google searches would prove to be of any help. This was until 1am last night when I sat up with jolt - why do epiphanic moments happen when you are trying to fall asleep.
When TextMate loads a project, it loads every file into memory and when focus is returned to the app it tries to refresh the project. Once I realised what the problem was, it was fairly easy to fix.
Exclude all media files (swf | mp3 | jpeg | gif | png ) from TextMate. See image below …
You can also exclude whole directories which is what I did and not surprisingly, TextMate went back to running at lightening speeds. Having the option to exclude certain directories and file types from loading is very helpful but loading files into memory isn’t such a good idea particularly in OS X where memory allocation is completely dynamic. Another peev for another day.
Perhaps the guys and gals over at macromates can take a look at this problem.