realm/realm-cocoa — pull request #1007 by tgoyne (2014-10-10 23:40:00+00:00)
Title: Optimize firstObject/lastObject/objectAtIndex at bit

I was going to complain about how suboptimal #1005 was due to using the public API but then decided to try to make the public API not so suboptimal instead. Makes `firstObject` and `lastObject` as much as twice as fast by ensuring that the `TableView` is created before we check the count, fast enumeration ~10% faster by using __unsafe_unretained in useful places, and `objectAtIndex:` ~30% faster by caching the objectSchema rather than looking it up on every access.

@alazier