As Python Speeds Up, It Could Have a Huge Impact on Finance Coding

While Python is one of the most widely-used coding languages in finance, it’s largely used in highly specialized functions such as data analytics rather than market-making software. This is because, as an interpreted language, Python is comparatively slow compared to alternatives like C++ or Java by virtue of its higher level of abstraction. 

However, Python’s creator, Guido Van Rossum, is keen to change this. Speaking at the recent Python Language Summit, Van Rossum said he intends to double the language’s speed when version 3.11 is released in October 2022. In the next four years, his intention is to increase the speed by a factor of five. 

Van Rossum’s presentation, posted on Github, explains how he hopes to bring this about, including an adaptative bytecode interpreter, optimizing the frame stack, and ‘zero overhead’ exception handling. If these changes double Python’s speed, Van Rossum said subsequent changes could include a stable ABI (application binary interface) or machine code generation to speed things up even further. 

Users of Python-based tools could benefit from the changes, said Van Rossum. Theoretically, this could include banks like JPMorgan and Bank of America, which are big users of the language in their risk-pricing systems… although JPMorgan has been very late in moving away from Python 2, and finance firms use the language for data analysis.

Van Rossum isn’t commenting on the likely implications of the changes to Python’s finance users. However, given that C++ is over 100 times faster than Python, it’s unlikely to make Python applicable for use in trading systems any time soon.

Jeffrey Ryan, the ex-foundational quant analyst at Citadel who’s now working as a ‘quant freelancer,’ says that because of Python’s “performance penalty,” it’s typically used in situations where speed doesn’t matter and ease of writing code does. 

A 2x increase in Python’s speed won’t really make much difference in finance. “Most compute heavy code used from python is already C (or C++/Fortran) internally – blas/lapack/numpy/tensorflow, etc,” Ryan says. “If absolute performance matters, you would likely write it once in C/++ and wrap it in python like these libraries do.”

Even if the language does become much faster in 2022 and beyond, Ryan says banks and other finance users may be slow to adopt its new iteration: “The change from 2.X to 3.X was far too painful and fresh for most people to go through again, and if anything I would think this could make people rethink using Python all together and move toward newer languages that make more sense – like Julia or Golang.” 

A modified version of this article originally appeared in eFinancialCareers.