Skip to content

Conversation

@arun-geek
Copy link
Contributor

  1. Avoid enumerate for first object check
  2. String is immutable and concating repeatedly can have performance issues if used at scale

1. Avoid enumerate for first object check
2.  String is immutable and concating repeatedly can have performance issues if used at scale
@arun-geek arun-geek requested a review from eyurtsev as a code owner October 26, 2025 02:01
@github-actions github-actions bot added core Related to the package `langchain-core` refactor labels Oct 26, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 26, 2025

CodSpeed Performance Report

Merging #33674 will not alter performance

Comparing arun-geek:refactor (163b931) with master (6e036d3)

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

Summary

✅ 13 untouched
⏩ 21 skipped1

Footnotes

  1. 21 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

for key, value in data.items():
text += key + ": " + stringify_value(value) + "\n"
return text
return "\n".join(key + ": " + stringify_value(value) for key, value in data.items())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is changing behavior to drop trailing newlines, which could break caches and is arguably not desired.

"""
llm_results = []
for i, gen_list in enumerate(self.generations):
for gen_list in self.generations:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see no compelling reason to make this change, conditioning on i == 0 is clear and readable with no performance issues.

@ccurme ccurme merged commit 86ac39e into langchain-ai:master Oct 27, 2025
74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Related to the package `langchain-core` refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants