In #283 we added a cache to things like List[str] that gives two orders of magnitude speedup. But the cache is only Python 3. We should add this to Python 2 as well. (Sadly the Python 2 stdlib doesn't have functools.lru_cache.)
FWIW A super-basic cache similar to the one used by re.compile() should work fine. Instead of maintaining an LRU data structure, it just erases the entire cache when max-cache is reached. The calculations we did in #283 (comment) suggest that a cache size of 128 should be a good start.
Activity
gvanrossum commented on Oct 4, 2016
FWIW A super-basic cache similar to the one used by re.compile() should work fine. Instead of maintaining an LRU data structure, it just erases the entire cache when max-cache is reached. The calculations we did in #283 (comment) suggest that a cache size of 128 should be a good start.
Add a (somewhat simple-minded) cache to the Python 2 version too. (#291)