Skip to content

chore(langchain): Refactor the string concatenation to use the more efficient .join() m…#32915

Closed
湛露先生 (zhanluxianshen) wants to merge 1 commit intolangchain-ai:masterfrom
zhanluxianshen:clean-str-appends
Closed

chore(langchain): Refactor the string concatenation to use the more efficient .join() m…#32915
湛露先生 (zhanluxianshen) wants to merge 1 commit intolangchain-ai:masterfrom
zhanluxianshen:clean-str-appends

Conversation

@zhanluxianshen
Copy link
Copy Markdown
Contributor

@zhanluxianshen 湛露先生 (zhanluxianshen) commented Sep 12, 2025

Refactor the string concatenation to use the more efficient .join() method.

Thank you for contributing to LangChain! Follow these steps to mark your pull request as ready for review. If any of these steps are not completed, your PR will not be considered for review.

  • PR title: Follows the format: {TYPE}({SCOPE}): {DESCRIPTION}

    • Examples:
      • feat(core): add multi-tenant support
      • fix(cli): resolve flag parsing error
      • docs(openai): update API usage examples
    • Allowed {TYPE} values:
      • feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert, release
    • Allowed {SCOPE} values (optional):
      • core, cli, langchain, standard-tests, docs, anthropic, chroma, deepseek, exa, fireworks, groq, huggingface, mistralai, nomic, ollama, openai, perplexity, prompty, qdrant, xai
    • Note: the {DESCRIPTION} must not start with an uppercase letter.
    • Once you've written the title, please delete this checklist item; do not include it in the PR.
  • PR message: Delete this entire checklist and replace with

  • Add tests and docs: If you're adding a new integration, you must include:

    1. A test for the integration, preferably unit tests that do not rely on network access,
    2. An example notebook showing its use. It lives in docs/docs/integrations directory.
  • Lint and test: Run make format, make lint and make test from the root of the package(s) you've modified. We will not consider a PR unless these three are passing in CI. See contribution guidelines for more.

Additional guidelines:

  • Most PRs should not touch more than one package.
  • Please do not add dependencies to pyproject.toml files (even optional ones) unless they are required for unit tests.
  • Changes should be backwards compatible.
  • Make sure optional dependencies are imported within a function.

@vercel
Copy link
Copy Markdown

vercel Bot commented Sep 12, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
langchain Ignored Ignored Preview Sep 12, 2025 8:30am

@zhanluxianshen 湛露先生 (zhanluxianshen) changed the title Refactor the string concatenation to use the more efficient .join() m… chore(langchain): Refactor the string concatenation to use the more efficient .join() m… Sep 12, 2025
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Sep 12, 2025

CodSpeed WallTime Performance Report

Merging #32915 will degrade performances by 16.1%

Comparing zhanluxianshen:clean-str-appends (649af3e) with master (649d8a8)

⚠️ 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

❌ 9 regressions
✅ 4 untouched

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
test_import_time[CallbackManager] 446.4 ms 525 ms -14.98%
test_import_time[HumanMessage] 211.3 ms 244.2 ms -13.46%
test_import_time[InMemoryRateLimiter] 164.9 ms 183.6 ms -10.2%
test_import_time[InMemoryVectorStore] 613.4 ms 717.8 ms -14.54%
test_import_time[LangChainTracer] 425.3 ms 493.7 ms -13.84%
test_import_time[PydanticOutputParser] 544.4 ms 637.1 ms -14.55%
test_import_time[RunnableLambda] 476.7 ms 539.8 ms -11.69%
test_import_time[Runnable] 477.9 ms 567.7 ms -15.81%
test_import_time[tool] 508.3 ms 605.9 ms -16.1%

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Sep 12, 2025

CodSpeed Instrumentation Performance Report

Merging #32915 will not alter performance

Comparing zhanluxianshen:clean-str-appends (649af3e) with master (649d8a8)

Summary

✅ 14 untouched

…ethod.

Signed-off-by: zhanluxianshen <zhanluxianshen@163.com>
Copy link
Copy Markdown
Collaborator

@eyurtsev Eugene Yurtsev (eyurtsev) left a comment

Choose a reason for hiding this comment

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

湛露先生 (@zhanluxianshen) thanks for taking the time to make a contribution. For optimizations we would generally want to see evidence that things make a difference. In this case, this optimization does not make any meaningful difference so we won't accept it.

I would suggest taking the patch and some of this information and discussing with chat gpt or claude and getting some critique in terms of what optimizations are meaningful or not :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants