Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dinmukhamedm
Copy link
Member

@dinmukhamedm dinmukhamedm commented Jul 5, 2025

Important

Optimized memory usage by removing unnecessary clones, refactoring code to use references, and adding methods to estimate data structure sizes.

  • Behavior:
    • Introduced estimate_size_bytes() in RRWebEvent and Event to calculate size in bytes.
    • Replaced clone() with references in BrowserEventCHRow and insert_browser_events().
    • Updated inner_process_queue_spans() to use estimate_size_bytes() for span and events.
  • Refactoring:
    • Removed convert_attribute() and integrated logic into convert_ai_sdk_tool_calls().
    • Modified input_chat_messages_from_genai_attributes() and output_from_genai_attributes() to remove attributes after use.
    • Reordered imports in browser_sessions.rs.
  • Misc:
    • Added comments for potential optimizations in record_span().
    • Removed redundant test code in spans.rs.

This description was created by Ellipsis for 136d415. You can customize this summary. It will automatically update as commits are pushed.

@dinmukhamedm dinmukhamedm marked this pull request as ready for review July 6, 2025 22:32
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed everything up to 38c4575 in 2 minutes and 5 seconds. Click for details.
  • Reviewed 479 lines of code in 7 files
  • Skipped 0 files when reviewing.
  • Skipped posting 8 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. app-server/src/ch/browser_events.rs:17
  • Draft comment:
    Good change: using a slice (&'a [u8]) for the data field avoids unnecessary cloning of binary data.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, as it praises the change without providing any actionable feedback or suggestions. It doesn't ask for clarification or suggest improvements.
2. app-server/src/db/events.rs:27
  • Draft comment:
    Nice addition of the estimate_size_bytes method for events. It computes size efficiently without expensive JSON conversion.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, as it only praises the addition of a method without providing any constructive feedback or suggestions for improvement. It doesn't align with the rules for useful comments.
3. app-server/src/db/spans.rs:207
  • Draft comment:
    In prepare_span_db_values, the previous conversion via convert_attribute is removed in favor of cloning values. Confirm that skipping attribute conversion is intentional.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. app-server/src/language_model/chat_message.rs:321
  • Draft comment:
    A TODO remains about removing clones. Consider applying a similar .remove() strategy as used in traces/spans.rs to avoid cloning where possible.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The comment points out a real issue (unnecessary cloning) and suggests a specific solution from another file. However, without seeing the traces/spans.rs file, we can't verify if that suggestion is actually applicable or helpful. The comment is also responding to a TODO that was just added, which suggests this may be something the author is already aware of and planning to address. I may be too quick to assume the solution from traces/spans.rs would work here without seeing that code. Also, if the author just added a TODO, they likely already plan to address this. While the specific solution suggestion may be premature without more context, pointing out opportunities for optimization with a concrete example is still potentially valuable feedback. The comment should be deleted since it's responding to a TODO the author just added and makes suggestions based on code we can't verify. Let the author handle the TODO as they see fit.
5. app-server/src/traces/consumer.rs:107
  • Draft comment:
    Refactoring to use span.estimate_size_bytes() and summing event sizes directly is an effective optimization over converting to JSON.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.
6. app-server/src/traces/spans.rs:817
  • Draft comment:
    Using .remove() on the attributes HashMap in input_chat_messages_from_genai_attributes avoids extra cloning. Ensure subsequent code does not rely on these keys later.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.
7. app-server/src/traces/spans.rs:455
  • Draft comment:
    In raw_base64_from_data_url, the regex match uses data_url.chars().take(50).collect() which allocates a new String. Consider using string slicing to avoid this minor allocation.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
8. app-server/src/traces/spans.rs:723
  • Draft comment:
    Consider using expression-based returns instead of explicit 'return' statements (e.g., in estimate_size_bytes) for more idiomatic Rust.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% While the suggestion would make the code more idiomatic Rust, the current code is perfectly functional and clear. The 'return' keyword actually helps readability here by making it explicit that this is the return value, especially given the long multi-line expression. The suggestion is purely stylistic and doesn't improve functionality or fix any real issues. The suggestion would make the code more idiomatic Rust. Expression-based returns are a core feature of Rust and using them consistently helps maintain a uniform codebase style. While idiomatic code is good, this change is purely cosmetic and the current code is actually more readable with the explicit return given the complexity of the expression. The benefit doesn't outweigh the cost of making the change. Delete the comment. While technically correct, this purely stylistic suggestion doesn't provide enough value to justify changing working code that is already clear and readable.

Workflow ID: wflow_CHONCl5CZoeVn1mw

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 136d415 in 45 seconds. Click for details.
  • Reviewed 30 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. app-server/src/traces/spans.rs:925
  • Draft comment:
    Nice optimization: using 'match &tool' and returning 'tool' avoids unnecessary cloning. Ensure that consuming 'ai.prompt.tools' via remove (and thus moving its value) is intentional.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None

Workflow ID: wflow_nHOvEttH3fWFxCyY

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@skull8888888 skull8888888 merged commit 4a0239b into dev Jul 7, 2025
1 check passed
@skull8888888 skull8888888 deleted the remove-more-clones branch July 7, 2025 09:43
dinmukhamedm added a commit that referenced this pull request Jul 8, 2025
…script (#690)

* feat: pass speed options (#682)

* remove cloning attributes as much as possible (#681)

* wip: remove cloning attributes as much as possible

* small refactor for testability + clone after filter

* tiny change, remove unnecessary ref

* add unit testing

* feat: enhance traces/shared traces (#683)

* feat: enhance traces WIP

* feat: update shared trace

* feat: refactor styles, add space listener, fix hydration error

* feat: trace id fix, default props to store, refactor store

* feat: add spanId as prop, fix navigation config

* feat: remove logs, add orderby to spans search

* feat: fix comments

* feat: update table columns

* feat: fix default width on client side

* feat: update evaluation trace view

* remove clones, slight refactor, .remove from hashmap where possible (#684)

* remove clones, slight refactor, .remove from hashmap where possible

* replace ai.prompt.tools in place per ellipsis

* Feat/custom renderer (#676)

* feat: custom renderer wip

* feat: custom renderer

* feat: update to jsx renderer

* fix

* feat: small fixes

* remove hover

* feat: refactor

* feat: fix update of custom renderer

* feat: update custom renderer

* fixes

---------

Co-authored-by: Robert Kim <[email protected]>

* feat: add telemetry (#686)

* feat: add telemetry

* feat: run otel only in prod

* allocator (#687)

* cleanup unused DB schema and code (#685)

* cleanup unused DB schema and code

* fix build

* return newly created tag class

* address ellipsis

* feat: fix css in rrweb events (#688)

* Feat/lam 653 (#678)

* feat: add domain check logic

* feat: remove agent chat feature

* feat: remove idnex from landing, .env

* feat: remove hardcoded value

* fix: link

* feat: revert

* update @codemirror/language (#691)

* fix: update cache update query to new pricing mode (#689)

* force update lockfile

---------

Co-authored-by: Olzhas Nurpeisov <[email protected]>
Co-authored-by: Robert Kim <[email protected]>
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.

3 participants