[PR #1597] [MERGED] Reduce cpu time spent on langchain-core utilities #2175

Closed
opened 2026-02-20 17:46:27 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/langgraph/pull/1597
Author: @nfcampos
Created: 9/3/2024
Status: Merged
Merged: 9/4/2024
Merged by: @nfcampos

Base: mainHead: nc/3sep/perf-optimizations


📝 Commits (9)

  • f2e0dc1 Reduce cpu time spent on langchain-core utilities
  • 535dbd5 Reduce from 9s to 4s on benchmark graph
  • cf345ef Store loop in async bg exec init
  • 4efab93 Use pseudo rng for uuid6 generation
  • b68f921 Run branch.reader in bg thread
  • 67a164c Run loop tick in bg thread
  • 26b4d91 Avoid using json encoding when generating task ids
  • b9361d6 Try to fix test
  • 3a1b90c Fix

📊 Changes

24 files changed (+963 additions, -478 deletions)

View changed files

📝 libs/checkpoint/langgraph/checkpoint/base/id.py (+3 -3)
📝 libs/langgraph/langgraph/graph/graph.py (+17 -10)
📝 libs/langgraph/langgraph/graph/state.py (+10 -13)
📝 libs/langgraph/langgraph/prebuilt/tool_executor.py (+1 -1)
📝 libs/langgraph/langgraph/prebuilt/tool_node.py (+1 -1)
📝 libs/langgraph/langgraph/prebuilt/tool_validator.py (+1 -1)
📝 libs/langgraph/langgraph/pregel/__init__.py (+16 -20)
📝 libs/langgraph/langgraph/pregel/algo.py (+19 -13)
libs/langgraph/langgraph/pregel/config.py (+0 -34)
📝 libs/langgraph/langgraph/pregel/executor.py (+3 -2)
📝 libs/langgraph/langgraph/pregel/loop.py (+1 -1)
📝 libs/langgraph/langgraph/pregel/manager.py (+4 -3)
📝 libs/langgraph/langgraph/pregel/read.py (+11 -9)
📝 libs/langgraph/langgraph/pregel/write.py (+39 -57)
libs/langgraph/langgraph/utils.py (+0 -282)
libs/langgraph/langgraph/utils/__init__.py (+0 -0)
libs/langgraph/langgraph/utils/config.py (+152 -0)
libs/langgraph/langgraph/utils/fields.py (+101 -0)
libs/langgraph/langgraph/utils/runnable.py (+519 -0)
📝 libs/langgraph/poetry.lock (+10 -5)

...and 4 more files

📄 Description

  • shaves off 7s of 11s runtime of a simple graph with 1,000 subgraphs

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/langgraph/pull/1597 **Author:** [@nfcampos](https://github.com/nfcampos) **Created:** 9/3/2024 **Status:** ✅ Merged **Merged:** 9/4/2024 **Merged by:** [@nfcampos](https://github.com/nfcampos) **Base:** `main` ← **Head:** `nc/3sep/perf-optimizations` --- ### 📝 Commits (9) - [`f2e0dc1`](https://github.com/langchain-ai/langgraph/commit/f2e0dc104246caa0100900d8f9a7b319020c5d88) Reduce cpu time spent on langchain-core utilities - [`535dbd5`](https://github.com/langchain-ai/langgraph/commit/535dbd5b06eb7976316badd3c2891f99bc2e02f6) Reduce from 9s to 4s on benchmark graph - [`cf345ef`](https://github.com/langchain-ai/langgraph/commit/cf345ef716758906c3cc5d868c4ecc345f6b5565) Store loop in async bg exec init - [`4efab93`](https://github.com/langchain-ai/langgraph/commit/4efab93e2fa65b6502b97c22bcb0bd4c1bb4fafc) Use pseudo rng for uuid6 generation - [`b68f921`](https://github.com/langchain-ai/langgraph/commit/b68f9211c2ee7de2c21f75a501aba47db4f71995) Run branch.reader in bg thread - [`67a164c`](https://github.com/langchain-ai/langgraph/commit/67a164ca2de8e19b1944b63310057b44a153ae02) Run loop tick in bg thread - [`26b4d91`](https://github.com/langchain-ai/langgraph/commit/26b4d9139ea26b405c5880fa6454dae8a8da44a0) Avoid using json encoding when generating task ids - [`b9361d6`](https://github.com/langchain-ai/langgraph/commit/b9361d69b4eb64694d9078ddc8ead26a08e4afc4) Try to fix test - [`3a1b90c`](https://github.com/langchain-ai/langgraph/commit/3a1b90c8821288e21486e92f200b75e0eea81c63) Fix ### 📊 Changes **24 files changed** (+963 additions, -478 deletions) <details> <summary>View changed files</summary> 📝 `libs/checkpoint/langgraph/checkpoint/base/id.py` (+3 -3) 📝 `libs/langgraph/langgraph/graph/graph.py` (+17 -10) 📝 `libs/langgraph/langgraph/graph/state.py` (+10 -13) 📝 `libs/langgraph/langgraph/prebuilt/tool_executor.py` (+1 -1) 📝 `libs/langgraph/langgraph/prebuilt/tool_node.py` (+1 -1) 📝 `libs/langgraph/langgraph/prebuilt/tool_validator.py` (+1 -1) 📝 `libs/langgraph/langgraph/pregel/__init__.py` (+16 -20) 📝 `libs/langgraph/langgraph/pregel/algo.py` (+19 -13) ➖ `libs/langgraph/langgraph/pregel/config.py` (+0 -34) 📝 `libs/langgraph/langgraph/pregel/executor.py` (+3 -2) 📝 `libs/langgraph/langgraph/pregel/loop.py` (+1 -1) 📝 `libs/langgraph/langgraph/pregel/manager.py` (+4 -3) 📝 `libs/langgraph/langgraph/pregel/read.py` (+11 -9) 📝 `libs/langgraph/langgraph/pregel/write.py` (+39 -57) ➖ `libs/langgraph/langgraph/utils.py` (+0 -282) ➕ `libs/langgraph/langgraph/utils/__init__.py` (+0 -0) ➕ `libs/langgraph/langgraph/utils/config.py` (+152 -0) ➕ `libs/langgraph/langgraph/utils/fields.py` (+101 -0) ➕ `libs/langgraph/langgraph/utils/runnable.py` (+519 -0) 📝 `libs/langgraph/poetry.lock` (+10 -5) _...and 4 more files_ </details> ### 📄 Description - shaves off 7s of 11s runtime of a simple graph with 1,000 subgraphs --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-20 17:46:27 -05:00
yindo closed this issue 2026-02-20 17:46:27 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#2175