GothenburgBitFactory / tasklib

A Python library for interacting with taskwarrior databases.
http://tasklib.readthedocs.org/en/latest/
BSD 3-Clause "New" or "Revised" License
146 stars 27 forks source link

Add `get_task` backend method with LRU cache #71

Closed robgolding closed 4 years ago

robgolding commented 4 years ago

This allows a faster lookup of tasks by ID, avoiding the need to re-query taskwarrior for the same data.

Fixes https://github.com/robgolding/tasklib/issues/70

robgolding commented 4 years ago

This improves the runtime of your benchmarking script quite a bit @thomasrebele!

loop1 time: 0.0264739990234375  tasks: 41
loop2 time: 0.040281057357788086  tasks: 41
coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.03%) to 92.149% when pulling 2e0e1e7e07f41dcd45ae8b571ab1409e73ccc453 on cache-tasks-by-uuid into 924e44b99f4c2c535c52f513e5d82f7a58a38629 on develop.

thomasrebele commented 4 years ago

The performance is much better with the cache. Thanks for the improvement!