【发布时间】:2022-01-01 09:46:19
【问题描述】:
我正在使用具有时间窗实现的 Google OR Tools VRP。我想激活缓存以加快速度。我有 python 3.7.4,所以我可以使用@lru_cache。我升级到 python 3.9 并使用 @cache 是否值得?
谢谢!
【问题讨论】:
标签: python-3.x caching or-tools
我正在使用具有时间窗实现的 Google OR Tools VRP。我想激活缓存以加快速度。我有 python 3.7.4,所以我可以使用@lru_cache。我升级到 python 3.9 并使用 @cache 是否值得?
谢谢!
【问题讨论】:
标签: python-3.x caching or-tools
看看source code,它就是这样:
def cache(user_function, /):
'Simple lightweight unbounded cache. Sometimes called "memoize".'
return lru_cache(maxsize=None)(user_function)
【讨论】: