[IMP] core: imcrease re.MAXCACHE

`re` is using an internal cache for regexes with a default size of 512
This is correct for small apps running on small infrastructure
but as a simple example, the routing map will compile ~1100 regex in a
row. This means that generating two routing map in a row don't benefit
from this cache at all. It looks reasonnable to increase this limit
globally for odoo.

This is visible when generating two routing map in a row.

After this change:

Generating routing map for key None
Routing map web generated in 0.194s
Generating routing map for key 1
Routing map website1 generated in 0.196s

After this change:

Generating routing map for key None
Routing map web generated in 0.200s
Generating routing map for key 1
Routing map website1 generated in 0.062s

Part-of: odoo/odoo#120542
This commit is contained in:
Xavier-Do
2023-05-10 15:19:47 +02:00
parent 63d54abe4b
commit 7fda050abd
+3 -4
View File
@@ -15,11 +15,8 @@ import atexit
import csv # pylint: disable=deprecated-module
import logging
import os
import signal
import re
import sys
import threading
import traceback
import time
from psycopg2 import ProgrammingError, errorcodes
@@ -33,6 +30,8 @@ __version__ = odoo.release.version
# Also use the `odoo` logger for the main script.
_logger = logging.getLogger('odoo')
re._MAXCACHE = 4096 # default is 512, a little too small for odoo
def check_root_user():
"""Warn if the process's user is 'root' (on POSIX system)."""
if os.name == 'posix':