isodatetime icon indicating copy to clipboard operation
isodatetime copied to clipboard

Cache method calls

Open MetRonnie opened this issue 5 years ago • 1 comments

Follow on from #162

Now that the data classes have been made hashable, the next step is to implement some form of lru_cache for some of the methods.

I think we wouldn't implement it for the certain methods whose return value depends on e.g. whether the Duration is in weeks mode or normal mode, such as get_is_in_weeks() or __str__().

MetRonnie avatar Jul 15 '20 09:07 MetRonnie

I think we wouldn't implement it for the certain methods whose return value depends on e.g. whether the Duration is in weeks mode or normal mode, such as get_is_in_weeks() or __str__().

Actually, should be possible to do something like use a private helper method that accepts an arg is_in_weeks and cache that instead, then wrap that helper with the public method

MetRonnie avatar Mar 31 '22 13:03 MetRonnie