From: Dmitry Selyutin Date: Sun, 18 Jun 2023 18:52:19 +0000 (+0300) Subject: dispatcher: cache dispatch calls X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b63709fa641bf63c20a409c73e47c1f585772e21;p=mdis.git dispatcher: cache dispatch calls --- diff --git a/src/mdis/dispatcher.py b/src/mdis/dispatcher.py index 3825b9e..a23cd02 100644 --- a/src/mdis/dispatcher.py +++ b/src/mdis/dispatcher.py @@ -5,6 +5,7 @@ __all__ = [ ] import collections +import functools import inspect import types @@ -68,6 +69,7 @@ class DispatcherMeta(type): return super().__new__(metacls, name, bases, ns) + @functools.lru_cache(maxsize=None) def dispatch(cls, typeid=object): hook = cls.__hooks__.get(typeid) if hook is not None: