Skip to content

Commit

Permalink
Fix benchmarks (#1056)
Browse files Browse the repository at this point in the history
- Some of the benchmark cases were too big so didnt finish
  • Loading branch information
nfcampos authored Oct 2, 2024
2 parents d08d392 + 968dcc5 commit e890d5e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
1 change: 1 addition & 0 deletions python/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
out
21 changes: 8 additions & 13 deletions python/bench/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ def __init__(self):
10_000,
),
(
"dumps_class_nested_py_branch_and_leaf_200x150",
"dumps_class_nested_py_branch_and_leaf_200x400",
lambda x: _dumps_json({"input": x}),
create_nested_instance(
200, 150, branch_constructor=MyClass, leaf_constructor=MyClass
200, 400, branch_constructor=MyClass, leaf_constructor=MyClass
),
),
(
Expand All @@ -43,29 +43,24 @@ def __init__(self):
create_nested_instance(50, 100, leaf_constructor=MyClass),
),
(
"dumps_class_nested_py_leaf_200x400",
"dumps_class_nested_py_leaf_100x200",
lambda x: _dumps_json({"input": x}),
create_nested_instance(200, 400, leaf_constructor=MyClass),
create_nested_instance(100, 200, leaf_constructor=MyClass),
),
(
"dumps_dataclass_nested_200x150",
"dumps_dataclass_nested_50x100",
lambda x: _dumps_json({"input": x}),
create_nested_instance(200, 150),
),
(
"dumps_pydantic_nested_200x400",
lambda x: _dumps_json({"input": x}),
create_nested_instance(200, 400, branch_constructor=DeeplyNestedModel),
create_nested_instance(50, 100),
),
(
"dumps_pydantic_nested_50x100",
lambda x: _dumps_json({"input": x}),
create_nested_instance(50, 100, branch_constructor=DeeplyNestedModel),
),
(
"dumps_pydanticv1_nested_200x150",
"dumps_pydanticv1_nested_50x100",
lambda x: _dumps_json({"input": x}),
create_nested_instance(200, 150, branch_constructor=DeeplyNestedModelV1),
create_nested_instance(50, 100, branch_constructor=DeeplyNestedModelV1),
),
)

Expand Down
3 changes: 3 additions & 0 deletions python/bench/create_run_tree.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import os
from unittest.mock import patch

from langsmith import RunTree

os.environ["LANGSMITH_API_KEY"] = "fake"


def create_run_trees(N: int):
with patch("langsmith.client.requests.Session", autospec=True):
Expand Down

0 comments on commit e890d5e

Please sign in to comment.