From ea873fd8f7c992b22dae47d309bc2685193401ac Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 05:19:53 +0000 Subject: [PATCH] perf: num2words, babel, gettext, sentry imports (backport #26475) (#26476) * perf: num2words, babel, gettext, sentry imports (#26475) num2words - 260KB - Used frequently on ERPNext sites. babel - 1.1MB Gets imported because of dates, localization sentry - 2.8MB should be loaded only if envvar is set gettext - required for reading translations (cherry picked from commit 445e1dbd6bfdd562274b93a576abf7d9e8136479) # Conflicts: # frappe/app.py # frappe/hooks.py # frappe/utils/sentry.py * chore: conflicts --------- Co-authored-by: Ankush Menat --- frappe/app.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frappe/app.py b/frappe/app.py index 4b10f7798da..f86fa8d1ed8 100644 --- a/frappe/app.py +++ b/frappe/app.py @@ -48,7 +48,9 @@ def __exit__(self, type, value, traceback): # If gc.freeze is done then importing modules before forking allows us to share the memory if frappe._tune_gc: + import babel.dates import bleach + import num2words import frappe.boot import frappe.client