russellmcdonell / pyDMNrules

An implementation of DMN (Decision Model Notation) in Python
Other
40 stars 9 forks source link

Slow Import of package #10

Closed lrnzkck closed 1 year ago

lrnzkck commented 1 year ago

When using this great package in my python project I noticed that using this package takes a long time. The time it takes from the line before

import pyDMNrules

to the line after that takes about 30 seconds. I also tried to import the used class but - of course - there is no time win. Is there a specific reason it takes a long time and is there an way to fix it?

russellmcdonell commented 1 year ago

Lorenz, pyDMNrules simply parses your Excel workbook (or XML file - but XML support is limited). That parsing does nothing more than extract the 'rules', which are pySFeel expressions. But that's another computer language, which has to be interpreted. That intepretation involves lots of pattern matching, using regular expression and another module called SLY. pySFeel defines lots of regular expression which SLY pre-compiles in order to make the run-time faster. That's where all the start up time is taken up.

The most frequent use case for pyDMNrules is to build a rules engine that is used over and over again to make lots and lots of decisions, each based upon different input data values. Think API service. So runtime performance is preferenced over startup performance.

To speed up startup time, I'd need to get SLY changed.

lrnzkck commented 1 year ago

Thanks a lot for your response! Gets more clear for me. Thanks for providing this tool!