- DATE:
- AUTHOR:
- The LangChain Team
๐ Performance enhancements & CI benchmarks for LangGraph Python library
We've shipped a number of updates to the LangGraph Python library! These include the following:
Performance Enhancements: We've made significant improvements to streamline processing and reduce overhead, enhancing overall performance while ensuring backwards compatibility.
Reduced redundant calls to
langchain.load.dumps
for the same object and objects that don't benefit from it.Replaced JSON serialization with MsgPack using custom extension types, improving speed and efficiency.
Avoided unnecessary object copies in dicts, lists, and checkpoints unless strictly required.
Switched
BaseChannel
and all subclasses to useslots
, optimizing memory usage.
Code Optimization & Simplification: Our focus was on removing inefficiencies and simplifying workflows for faster execution.
Eliminated the creation of new
CallbackManager
instances when an existing one is available.Re-implemented
langchain_core.runnables.ensure_config
andmerge_configs
to avoid unnecessary calls.Simplified checkpoint and task ID generation using pseudo-random numbers instead of cryptographically secure bytes.
CI Benchmarks & Caching Improvements: To maintain high performance, we've introduced CI benchmarks and improved caching mechanisms.
Added performance benchmarks running on CI to track and maintain improvements.
Cached function signature checks in
RunnableCallable
, reducing unnecessary lookups.Avoided dynamic
ChannelWrite
runnable creation in conditional edges, improving execution flow.
These updates collectively enhance LangGraphโs performance and reliability, making it faster and more efficient for users.