I stumbled across #1352 Enumerable#group_by is O(n^2) - Ruby on Rails - rails recently
A quick investigation reveals that the complexity with respect to the number of groups is indeed noticeably worse. The commit that introduced this ( http://github.com/rails/rails/commit/8273280a637a5e40de2c37dd1da507c749b11aab ) does make that particular code a lot neater, but was the performance regression an intended side-effect ?
Fred