From ade0f07eacd6045f094327dd3f7a18beadf445bf Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 17 Sep 2024 10:08:07 +0530 Subject: [PATCH] Use an LRU cache for guess_type --- src/calibre/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/calibre/__init__.py b/src/calibre/__init__.py index 41c650fd88f1..37bb1bb63588 100644 --- a/src/calibre/__init__.py +++ b/src/calibre/__init__.py @@ -56,6 +56,7 @@ def _init_mimetypes(): _mt_inited = True +@lru_cache(4096) def guess_type(*args, **kwargs): import mimetypes if not _mt_inited: