abcsys / libem

Compound AI toolchain for fast and accurate entity matching, powered by LLMs.
https://libem.org
Apache License 2.0
19 stars 3 forks source link

perf: lazy load heavy modules to cut cli init time #72

Closed zenodflow closed 3 months ago

zenodflow commented 3 months ago

Now:

Import Time [s] Module 1.042802 libem.resolve.cluster.interface 0.992084 libem 0.959488 libem.interface 0.774706 libem.core.model 0.535536 pandas 0.509240 0.237741 pandas.core.api 0.219844 _api 0.206156 _client 0.190365 httpx 0.189074 openai 0.124320 _utils 0.120118 pandas.compat 0.118033 _models 0.116515 numpy 0.112245 pandas.compat.pyarrow 0.112218 pyarrow 0.109185 pyarrow.lib 0.104290 batch 0.103961 beta 0.092054 runs 0.089247 pandas.core.groupby 0.083747 _transports.default 0.083662 pandas.core.groupby.generic 0.083431 httpcore 0.082871 pandas._libs 0.077499 _sync.connection_pool 0.077248 connection 0.075082 pandas.core.arrays 0.073685 numpy.core._multiarray_umath

zenodflow commented 3 months ago

Further reduced with dynamic integration loading (e910ffa):

Import Time [s] Module 0.773030 libem.core.model 0.592930 libem 0.514184 0.437418 libem.interface 0.219452 _api 0.204635 _client 0.191811 openai 0.187499 httpx 0.130662 _utils 0.123206 libem.core.trace 0.123139 numpy 0.121806 _models 0.108100 batch 0.101412 beta 0.089567 runs 0.083572 _transports.default 0.083251 httpcore 0.077254 _sync.connection_pool 0.077002 connection 0.066439 _synchronization 0.065559 _compat 0.064690 numpy.core._multiarray_umath 0.050994 trio 0.050573 _auth 0.046774 threads 0.044859 _main 0.044179 libem.tune.learn.icl 0.044050 numpy.config 0.042372 steps 0.036936 _core