-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Performance improvements in core library (#1683)
* Performance improvements in core library - Avoid creating new callback manager when received one as arg - Avoid looking for config when already received one as arg - Avoid copies of values in ensure_config/merge_configs - Implement version of ensure_config that accepts multiple configs (avoids calling merge_configs first) - Avoid calling merge_configs when we only need to attach extra tags/metadata * Fix * Fix * Try again * Debug ci job * Fix * Try again * Try again * Try again * Some more variations * Attach annotation to first changed file * Fix * Re-enable benchmarks
- Loading branch information
Showing
10 changed files
with
257 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,20 +27,25 @@ jobs: | |
- name: Install dependencies | ||
run: poetry install --with dev | ||
- name: Run benchmarks | ||
run: make benchmark | ||
run: OUTPUT=out/benchmark-baseline.json make -s benchmark | ||
- name: Upload benchmark baseline | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: benchmark-baseline.json | ||
path: libs/langgraph/out/benchmark.json | ||
compare: | ||
name: benchmark-baseline | ||
path: libs/langgraph/out/benchmark-baseline.json | ||
benchmark: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: libs/langgraph | ||
needs: [baseline] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- id: files | ||
name: Get changed files | ||
uses: Ana06/[email protected] | ||
with: | ||
format: json | ||
- name: Set up Python 3.11 + Poetry ${{ env.POETRY_VERSION }} | ||
uses: "./.github/actions/poetry_setup" | ||
with: | ||
|
@@ -50,13 +55,36 @@ jobs: | |
- name: Install dependencies | ||
run: poetry install --with dev | ||
- name: Run benchmarks | ||
run: make benchmark | ||
id: benchmark | ||
run: | | ||
{ | ||
echo 'OUTPUT<<EOF' | ||
make -s benchmark | ||
echo EOF | ||
} >> "$GITHUB_OUTPUT" | ||
- name: Download benchmark baseline | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: benchmark-baseline.json | ||
path: libs/langgraph/out | ||
merge-multiple: true | ||
- name: Compare benchmarks | ||
run: poetry run pyperf compare_to out/benchmark-baseline.json out/benchmark.json --table --group-by-speed >> $GITHUB_OUTPUT | ||
id: compare | ||
run: | | ||
{ | ||
echo 'OUTPUT<<EOF' | ||
poetry run pyperf compare_to out/benchmark-baseline.json out/benchmark.json --table --group-by-speed | ||
echo EOF | ||
} >> "$GITHUB_OUTPUT" | ||
- name: Annotation | ||
run: echo "::notice file=libs/langgraph/bench/__main__.py::$GITHUB_OUTPUT" | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const file = JSON.parse(`${{ steps.files.outputs.added_modified_renamed }}`)[0] | ||
core.notice(`${{ steps.benchmark.outputs.OUTPUT }}`, { | ||
title: 'Benchmark results', | ||
file, | ||
}) | ||
core.notice(`${{ steps.compare.outputs.OUTPUT }}`, { | ||
title: 'Comparison against main', | ||
file, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.