Skip to content

Consider replacing memoized functions with lru_cache #174

@nrejac

Description

@nrejac

Python 3.2 now includes memoization in the functools module. It's implemented in C, and using it is simple:

import functools

@functools.lru_cache()
def fib_lru_cache(n):
    if n < 2:
        return n
    else:
        return fib_lru_cache(n - 2) + fib_lru_cache(n - 1)

Consider replacing the memoization functions implemented in: idb/helpers/memoize.py with the new, standard lru_cache. Then, adjust the existing calls to memoized functions to use the new lru_cache.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions