nerdvegas/rez — pull request #109 by mstreatfield (2014-10-14 06:51:39+00:00)
Title: Misc Performance Improvements

This change brings together a number of smaller performance improvements.

Individually, on a single iteration none of these give much. However the sheer number of times they are called when resolving a context means that together they can remove seconds from the execution time.

1. `super` was being called unnecessarily on a class which had no parents. This class is instanced thousands of times.
2. The solver is sending strings to the printer, even if they may not be displayed (`self.verbose==False`). As the `%s` operator in the string formatting line with call `str` for us, there is no need to do it explicitly. We can take advantage of this by passing the arguments separating. This is similar to the way some loggers etc work.
3. Move some nested imports to the top level (you'd be surprised).
4. Replace list comprehensions with a map operation for added vroom.
5. Some minor optimisations to the `__get__` method to reduce the number of dictionary lookups.

Again, individually, on a single iteration none of these give much. However the sheer number of times they are called when resolving a context means that together they can remove seconds from the execution time.