haystack/releasenotes/notes/optimize-import-times-935e1387beeb3a52.yaml
Stefano Fiorucci 9546e69374
perf: Optimize import times (#8878)
* initial experiments

* progress

* draft

* fix header

* fix linting

* lot more lazy inits

* fixes to main init

* linting

* small refinements

* header fix

* release note

* improve consistency

* test: make sure no extra modules are being imported due to `__init__` definitions

* extend release note with an example

* refactoring import test

* updating release notes

* casting .keys() to list

* reverting to list

* Update haystack/__init__.py

Co-authored-by: Julian Risch <julian.risch@deepset.ai>

* fixing ident problem

* better comments

---------

Co-authored-by: David S. Batista <dsbatista@gmail.com>
Co-authored-by: Julian Risch <julian.risch@deepset.ai>
2025-02-21 09:55:20 +01:00

14 lines
628 B
YAML

---
highlights: >
Thanks to lazy imports, Haystack's import performance has significantly improved.
Importing individual components now uses 50% less CPU time on average.
The overall import performance has also improved: for example,
`import haystack` now uses between 2-5% of its previous CPU time.
enhancements:
- |
Optimize import times through extensive use of lazy imports across packages.
Importing one component of a certain package, no longer leads to importing all components of
the same package.
For example, importing OpenAIChatGenerator no longer imports AzureOpenAIChatGenerator.