Super-charging Python code with C-Extensions or Cython
Posted on Sun 16 December 2012 in XBRL
Regarding my previous post that was Financial Analytics in XBRL was in pure-python with little bit 'C' touch (because of my base xml parsing lib is cElementTree). It was taking 20-21 mins to process 200 xbrl packages.
But thats not the end; I have optimized it with
Cython. Its a C-extensions in python,
giving multiple folds increase in the performance.
I have just converted my raw module to '.so' and then imported it as
usual; and i found 25% reduction in time. Its now near 14-15min for the
same data set of 200 xbrl fillings.
See the screen-shot which i have just taken;
Here i have not implemented any type declaration or typed arguments; and
yet i got 25% reduction in overall time. So you can imagine what will
happen when i will implement those changes.
Anyway; 'C' rocks!!!!!