Learn a few ways to speed up your python code.
The question provides the initial code making use of
Speed up Python code that uses NumPy
Speed Up Your Python classes with slot - DEV Community
Understanding CPUs can help speed up Numba and NumPy code : r/Python
WWCode Talks Tech #16: Optimizing Python Code - Women Who Code
Fast Python loops with Cython
Speeding Up The Python Code Bayshore Intelligence Solutions
Writing Faster Python 3
Speed Up Your Python Code With 100% Thread Utilization Using This
Python Performance Hacks: 7 Ways to Speed Up Your Code by 92%
Make Python 1000x Faster With One Line 🐍 ⏩ (Numba Tutorial
Speed up your Python with Numba
Speed up your Python code using Julia
5 Tips and Tricks to speed up your Python Programs