When generating RDoc output, index_to_links is inefficient:
- It sorts its given collection on every call.
- It calls non-in-place methods to sort, map and compact its given collection.
index_to_links is called every often: about 3 times for each file, class and method.
With this patch, the collections are sorted only once. It also reduces the amount of garbage objects by using in-place
array manipulation methods as much as possible. This yields an overall performance improvement of about 14%.
This patch has been tested against the RDoc sources itself as well as against the Ruby 1.8 standard library, with both
the default template and the Hanna template. |