nerdvegas/rez — pull request #106 by mstreatfield (2014-10-09 05:10:49+00:00)
Title: + Allow a cache size of -1 to be specified.  This creates a cache of inf...

In the discussion around pull request #92 I mentioned that the lru cache used by Rez (a backport of that now standard in Python 3) was slowing the execution of `rez env` due to a large number of lock operations.

While investigating this further, I discovered the current lru cache implementation allows for a lock free cache if a max size is not set (when `maxsize=None`). This is still thread safe, but much quicker. As the number and size of the items cached by Rez is relatively small a max size isn't strictly necessary so we can make use of this feature. This change allows a user to specify a cache size of -1 in the `rezconfig` file to activate this type of cache.

* Increase the fallback cache size of 100 in `config.py` to something more sensible.
* If the cache size is -1 create an lru cache of `maxsize=None`. (Given this configuration value is of type `int`, this seemed easier than adding support for `None` values to this setting).
* The `_get_regex` method now creates the lru cache through the config decorator so is inline with other caches used by this module.
* Expand the documentation in rezconfig relating to the `resource_caching_maxsize` setting (although I've not changed the default to -1).
* Removed some unused imports in `resources.py`.
* `sys.exc_traceback` has been deprecated (and removed in python 2.6 I think) so I replaced the reference in `resources.py` with `sys.exc_info()`.

In testing, I see ~10% improvement in performance of rez env with this change implemented and the config updated.