Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
cache_times = []
timer = make_timer(cache_times)
options = {
('No Caching', 'no-caching.png'): [
timer,
],
('Traditional Caching', 'traditional-caching.png'): [
timer,
cache.memoize(expire=1),
],
('Synchronized Locking', 'synchronized-locking.png'): [
timer,
cache.memoize(expire=0),
dc.barrier(cache, dc.Lock),
cache.memoize(expire=1),
],
('Early Recomputation', 'early-recomputation.png'): [
timer,
dc.memoize_stampede(cache, expire=1),
],
('Early Recomputation (beta=0.5)', 'early-recomputation-05.png'): [
timer,
dc.memoize_stampede(cache, expire=1, beta=0.5),
],
('Early Recomputation (beta=0.3)', 'early-recomputation-03.png'): [
timer,
dc.memoize_stampede(cache, expire=1, beta=0.3),
],
}