PyXLL 5.5.0 supports using Python 3.11 in Excel.
When looking back at history of Python we may well remember Python 3.11 as a major milestone. The performance of Python has long been a topic of debate among even the most dedicated Python fans. Python detractors often quote performance as a reason (often unfounded!) not to use Python.
There has been a huge focus in performance in Python 3.11, and the results are impressive. Checkout the benchmarks for yourself over at https://openbenchmarking.org/result/2205310-PTS-PYTHON3127.
The increase in performance over Python 3.10 is 40% when looking at the mean over all benchmarks. Against Python 3.8 the performance increase is a massive 48%! This is of course an average figure and the performance increase is greater for some benchmarks than others.
What does this mean for the performance of your Python powered Excel spreadsheets?
The Python for Excel add-in PyXLL seamlessly integrates Python code into Excel. The PyXLL add-in fully supports Python 3.11. You can take advantage of these performance benefits by upgrading to Python 3.11 and the latest version of PyXLL.
Using PyXLL is by far the fastest way to integrate your Python code into Excel. Your Python code will run faster in Python 3.11. That performance gain will directly impact the performance of your spreadsheets powered by Python using PyXLL.
Should I upgrade to Python 3.11 right now?
Python package maintainers sometimes take up to a few months to update their packages to a new version of Python. Whether you want to upgrade immediately or not will depend on what packages you are using. I would recommend checking support for any major dependencies you have before attempting to upgrade. If you need a package that doesn’t yet have Python 3.11 support, check again in a few weeks; or even consider submitting a pull request to the project if you are able to upgrade it yourself!
We always thoroughly test the PyXLL add-in well before the release of any new Python version. If your code can be run using Python 3.11, you will have no trouble using it in Excel with PyXLL.
Is Everything faster in Python 3.11?
No. Many Python packages such as numpy, scipy and pandas use extensive amounts of compiled code (e.g. C, C++ and Fortran). The performance improvements in Python 3.11 only affect the Python interpreter. These improvements will not affect compiled code written in another language. If the bottlenecks in your code are in these compiled extensions you may not see any difference in performance.
When discussing performance and making Python code run faster my advice is always to profile your code. That is the only way you can really see where time is being spent so you can make effective, targeted improvements.
Profiling Excel spreadsheets powered by Python is the topic of the blog post How to profile Python code in Excel.