Reduce CPU usage of RubyCocoa app

I found Gmail Notifr consumed 2% of CPU usage, even when it’s idle (Gmail Notifr checks new mails at an interval that could be configured by user). It was really odd as the app doesn’t do much job other than visiting the gmail feed and fetching the new mails count.

So I ran several Xcode RubyCocoa example apps provided by Apple. They seemed to act like that also.

A quick google search brought me to this discussion: CPU Usage. Not knowing what kind of problem they had, I tried adding the OSX.ruby_thread_switcher_stop to the application controller and test it. Wow, the cpu usage became low as 0%.

Rubycocoa cpu Usage

For now I have no idea if this would cause any problem to the app, I’ll just keep the code and see if Gmail Notifr runs normally.