- After making some changes to our RSpec suite (namely moving to fixture scenarios), we realized almost a 50% improvement on our local dev boxes (generally iMacs with 4G of ram). However the CI box (a Mac Mini) remained at about the same duration. Increasing the InnoDB MySQL settings to the following caused a significant performance boost on our CI box (about 200 seconds down from 350 seconds):
innodb_buffer_pool_size = 64M
innodb_log_buffer_size = 8M
table_cache = 512
query_cache_size = 8M
The theory is that our local dev boxes have so much ram that the disk reads are cached while the CI box is swapping out to disk often.
- Fixtures in RSpec can be slow due to nested describe blocks. Each time a new describe block is opened, the fixtures have to load. Therefore, if your test suite has many nested describe blocks with only a few tests in each describe, this will cause lots of fixture loading.
One possible solution is to use the underlying database (e.g.. MySQL SAVEPOINT and ROLLBACK TO SAVEPOINT) to save and reload the fixtures. Another possibility is to group your tests in a less-nested fashion.