Update performance improvements

Use Array#sort_by instead of Array#sort.
This change improves update performance.
It is 25% faster than before.
Before: 16min
After: 12min
OS: Ubuntu 13.04 x86
CPU: Intel Core i5 M450 2.4GHz
Memory: 2GB
Ruby: 1.9.3p448