-
Notifications
You must be signed in to change notification settings - Fork 155
remove clones, slight refactor, .remove from hashmap where possible #684
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
Conversation
There was a problem hiding this 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.
There was a problem hiding this 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
479lines of code in7files - Skipped
0files when reviewing. - Skipped posting
8draft 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%<= threshold50%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%<= threshold50%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 by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this 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
30lines of code in1files - Skipped
0files when reviewing. - Skipped posting
1draft 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%<= threshold50%None
Workflow ID: wflow_nHOvEttH3fWFxCyY
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
…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]>
Important
Optimized memory usage by removing unnecessary clones, refactoring code to use references, and adding methods to estimate data structure sizes.
estimate_size_bytes()inRRWebEventandEventto calculate size in bytes.clone()with references inBrowserEventCHRowandinsert_browser_events().inner_process_queue_spans()to useestimate_size_bytes()forspanandevents.convert_attribute()and integrated logic intoconvert_ai_sdk_tool_calls().input_chat_messages_from_genai_attributes()andoutput_from_genai_attributes()to remove attributes after use.browser_sessions.rs.record_span().spans.rs.This description was created by
for 136d415. You can customize this summary. It will automatically update as commits are pushed.