# Python 3.13 introduced:# 1. Experimental JIT compiler (--enable-experimental-jit)# 2. Free-threaded mode (no GIL) via python3.13t# 3. Improved error messages with colorimport sys
print(f"Python {sys.version}")# Check if GIL is disabled (3.13+)# sys._is_gil_enabled() # returns False in free-threaded build
Note Python 3.13's free-threaded build removes the GIL experimentally. Most C extensions need updating to work without the GIL. The JIT is opt-in and best for CPU-bound loops.
JS: const re = new RegExp(pattern, flags)
Python: re.compile(pattern, flags)
Example
JS:const dateRe =newRegExp('\\d{4}-\\d{2}-\\d{2}','g');
dateRe.test('2026-04-04');Py: date_re = re.compile(r'\d{4}-\d{2}-\d{2}')
date_re.findall('2026-04-04 and 2025-12-25')
Output
JS: true
Py: ['2026-04-04', '2025-12-25']
Note Compiling is beneficial when the same pattern is used repeatedly (e.g., in a loop). Python caches the most recent patterns automatically, but explicit compilation is clearer and avoids cache eviction. In JS, the RegExp constructor requires double-escaping backslashes in string form.
-- Often slow (index may not be used):WHERE city ='Seattle'OR state ='WA'-- Faster alternative:SELECT...WHERE city ='Seattle'UNIONSELECT...WHERE state ='WA';
Example
-- May not use either index effectively:SELECT*FROM users
WHERE email ='[email protected]'OR phone ='2065551234';-- Better with UNION (each query uses its own index):SELECT*FROM users WHERE email ='[email protected]'UNIONSELECT*FROM users WHERE phone ='2065551234';
Output
-- UNION lets each branch use its optimal index
Note OR conditions on different columns often prevent the optimizer from using indexes efficiently. Rewriting as UNION (or UNION ALL if you know there are no duplicates) lets each branch use its own index. Check with EXPLAIN to verify.
Frequently asked questions
How does Python handle performance?
This task is covered in 3 stacks on this page: Python, Regular Expressions, SQL. The "Performance Features (3.13+)" snippet in Python uses `# JIT compiler, free-threaded mode`.
Which code does the Python example use?
The "Performance Features (3.13+)" snippet uses `# JIT compiler, free-threaded mode`, from the Modern Features section of the Python cheat sheet.
Which stacks cover "performance" on this page?
Python, Regular Expressions, SQL. Together they hold 3 copy-ready snippets for this task.
Is there anything to watch out for?
Yes. For "Performance Features (3.13+)": Python 3.13's free-threaded build removes the GIL experimentally. Most C extensions need updating to work without the GIL. The JIT is opt-in and best for CPU-bound loops.