|
From: Alix L. <ali...@gm...> - 2021-06-02 07:37:38
|
Hello Luigi and QL-community, I would like to share some of my findings regarding QuantLib performance in Python. Over the last few days, I was comparing the speed of SABR formula run through 3 different ways in Python: 1/ the pure Python implementation (my benchmark), 2/ the exposed Python function via QuantLib SWIG, and 3/ the same formula compiled through Cython. I would expect method 3 with Cython to reach the same level of performance of the usual QuantLib-Python from method 2 with a backend in C++, but I am surprised to observe Cython is faster than QuantLib-Python by a factor of around 2 (see attached python script extracted from a notebook). QuantLib C++ was compiled with the below command ./configure --enable-unity-build --disable-static CC=clang CXX=clang++ CXXFLAGS= '-O3 -g0 -fPIC' And then, QuantLib-Python: ./configure PYTHON=/usr/bin/python3 CXXFLAGS='-O3' I also tried to compile PyQL, and I observed the same level of speed-up. Should I review the compilation of QuantLb in C++ or SWIG to increase the performance? Interested to know any thoughts! Thanks, Alix |