djay0529 / mdanalysis

Automatically exported from code.google.com/p/mdanalysis
0 stars 0 forks source link

"cached" decorator #207

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Purpose of code changes on this branch:
Added a decorator which automates caching of class methods.

Changed "__cache" to "_cache" so the decorator can see the cache (it's external 
to the Class instance)

When reviewing my code changes, please focus on:
Hopefully the decorator makes it easier to understand code as everything isn't 
inside an if statement, so what you see is just how things are done to make 
that attribute.

Performancewise it shouldn't make much difference, arguably the old method did 
2 dict lookups and this uses try/except instead, but is wrapped in function 
calls.

Moving "__cache" to "_cache" shouldn't break anything? and makes "_fill_cache" 
redundant.

After the review, I'll merge this branch into:
/develop

Original issue reported on code.google.com by richardjgowers on 25 Jan 2015 at 11:38

GoogleCodeExporter commented 9 years ago
https://code.google.com/p/mdanalysis/source/detail?r=f14c5d35516d75029bb6ebe1987
d13966a59ca78&name=feature-cachedecorator

Original comment by richardjgowers on 25 Jan 2015 at 11:38

GoogleCodeExporter commented 9 years ago

Original comment by richardjgowers on 26 Jan 2015 at 1:32

GoogleCodeExporter commented 9 years ago
Merged with develop

https://code.google.com/p/mdanalysis/source/detail?r=ab943cab119d467b0889917fc88
cd28c2e3229eb&name=develop

Original comment by richardjgowers on 30 Jan 2015 at 9:26