Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: serialization #6955

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

fix: serialization #6955

wants to merge 3 commits into from

Conversation

italojohnny
Copy link
Member

No description provided.

@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Mar 6, 2025
@italojohnny italojohnny force-pushed the ija/fix_serialization branch from 3976ec1 to f21ab3a Compare March 6, 2025 19:38
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Mar 6, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Mar 6, 2025
codeflash-ai bot added a commit that referenced this pull request Mar 6, 2025
…a/fix_serialization`)

To optimize the given code for better runtime performance while preserving its functionality, I will make the following changes.
1. Utilize list comprehensions for better performance.
2. Remove unnecessary checks and computations inside loops.

Here's the optimized version of the code.



**Explanation of Changes:**
- Replaced the loop with a list comprehension to serialize the outputs, which is generally faster and more Pythonic.
- Removed the unnecessary initial assignment `serialized["outputs"] = []` as it gets replaced anyway if `self.outputs` exists.
- Encapsulated exception handling (`try-except`) around the whole potentially faulty block ensuring the encoder only runs once when serialization is attempted.

This should improve runtime performance by reducing unnecessary loops and intermediate operations.
Copy link
Contributor

codeflash-ai bot commented Mar 6, 2025

⚡️ Codeflash found optimizations for this PR

📄 1,373% (13.73x) speedup for RunResponse.serialize in src/backend/base/langflow/api/v1/schemas.py

⏱️ Runtime : 28.2 microseconds 1.91 microseconds (best of 33 runs)

I created a new dependent PR with the suggested changes. Please review:

If you approve, it will be merged into this PR (branch ija/fix_serialization).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant