Improved filesystem efficiency

Previously, `sheets.print()` would query the filesystem every time it
was invoked. This was inelegant, because it is called multiple times
every time `cheat` is executed. Thus, unnecessary calls were being made
out to the filesystem.

Now the result of that function is being buffered into a module variable
when it is executed the first time, and served from there thereafter. I
broke the "functional" paradigm to a degree by doing this, but it wasn't
worth the complexity of implementing proper memoization (decorators,
etc) for such a trivial case.

Bumped the version number accordingly.
This commit is contained in:
Chris Lane
2014-05-25 21:55:25 -04:00
parent f128167311
commit afcaaafbe5
3 changed files with 15 additions and 4 deletions

View File

@ -38,7 +38,7 @@ from docopt import docopt
if __name__ == '__main__':
# parse the command-line options
options = docopt(__doc__, version='cheat 2.0.3')
options = docopt(__doc__, version='cheat 2.0.4')
# list directories
if options['--directories']: