| «« FanConcert's Got Mail | Transient Tags on FanConcert and Artists Requiring Updates »» |
|
About
I'm Ryan Lowe, a Software Engineering graduate living in Ottawa, Canada. I like agile software development and Ruby on Rails.
I write this blog in Canadian English and don't use a spell checker. Typos happen.
Projects
» Full-time Ruby on Rails freelancer
» Full-time with Rails since May 2005 » Former committer for RadRails (now Aptana) » I also have a few Rails side-projects in development: 1. wheretogoinTO.com Toronto nightlife 2. Hey Heads Up! TODO list and sharing 3. Layered Genealogy family history research 4. foos for foosball scoring 5. fanconcert for music fans (on hold) Hiring Rails developers? I can telecommute by the hour from Ottawa, Canada »» Email: rails AT ryanlowe DOT ca
BulletBlog
Now hosted on Hey! Heads Up -- check it out!
Syndication
Pings
Recent
Derek Lowe's (Ryan's older brother) words at Ryan's funeral
blog@ryanlowe.ca no more Forging Email Headers: Good, Bad or Ugly? Sarcastic Dictionary (Part 1 of Many) Tags Hierarchies Twisting Rails is Risky Business Risky Business? My Take on Early Alphas Whoa, it's August 2007 Closing Comments A Postscript to "Growth at the grassroots" »» All Blog Posts
Linkage
del.icio.us/ryanlowe
technorati/ryanlowe.ca/blog Aurora Roy Jim Andrew Trasker Travis Kibbee Karen Dr. Unk Ayana Van Bloggers Joel Spolsky Robert Scoble Tim Bray Dave Winer Raymond Chen James Robertson Ruby/Rails Bloggers rubyonrails.org weblog David Heinemeier Hansson Dave Thomas James Duncan Davidson Mike Clark Jamis Buck Signal vs. Noise Tobias Luetke Amy Hoy: (24)slash7 Jeremy Voorhis Eclipse Bloggers Planet Eclipse EclipseZone Luis de la Rosa Eclipse Foundation Kim Horne Billy Biggs Ian Skerrett Mike Milinkovich Bjorn Freeman-Benson Denis Roy
Archives
|
Ruby on Rails 1.0 Test Performance
The new Ruby on Rails project I'm working on is giving me an opportunity to start from scratch and incorporate all of the lessons I've learned from FanConcert so far. The new project is also giving me an opportunity to try out new things with Rails with a clean slate and then incorporate those things in FanConcert. It's benefitting both projects. An example is Ruby on Rails' testing support, which has been improved for the 1.0 release. Rails testing supports two new settings: 1) transactional fixtures and 2) not using instantiated fixtures. Both of these settings can improve the performance of unit/functional test runs, which improves the speed of development if you run the tests a lot -- and given I like to test first, I run tests a lot. What are these two settings? First I need to explain what Rails fixtures are: they are objects that are loaded into the test database at the beginning of every test method and used during the test. Fixtures are deleted and freshly reloaded after each test method to avoid method-to-method side effects -- very important!. Transactional fixtures leverage a database's support for transactions to rollback the database after each test method instead of deleting all of the records and reloading them. This can result in a large performance improvement, as you will see by my numbers below. Instantiated fixtures are fixtures in the form of regular Ruby objects available in test methods as instantiated member-level objects. If you don't need to create these instantiated fixtures before each test method, you'll save time. There's another benefit to not using instantiated fixtures: readability. Here's a comparison:
Sometimes the type of the object isn't this obvious, and the explicit use of the class name to access the fixure -- -- What are the performance benefits? Here are the numbers for FanConcert (mean results over several runs): Old Rails default - unoptimized: Using transactional fixtures: New Rails default - Transactional fixtures, not instantiated fixtures: As you can see, using transactional fixtures reduced the test run time almost in half. Then not using instantiated fixtures reduced the test run time almost in half again. After using both of these settings my total test suite run is over 3 times faster! How can I not be happy with those kinds of real-world results? Posted at January 22, 2006 at 06:28 PM ESTLast updated January 22, 2006 at 06:28 PM EST Comments
|