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

chore: changed evaluateTree to use klonaJSON #37976

Merged
merged 2 commits into from
Dec 7, 2024
Merged

Conversation

vsvamsi1
Copy link
Contributor

@vsvamsi1 vsvamsi1 commented Dec 5, 2024

Description

Changed from klona to klonaJson since we have seen that evalAndValidateFirstTree we are already performing klonaJSON which serialised all non primitive dataTypes. So the subsequent evaluations do not need to perform a full klona. We are seeing a 33% reduction in klona scripting time in the webworker.

Fixes #Issue Number
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

/ok-to-test tags="@tag.All"

🔍 Cypress test results

Caution

🔴 🔴 🔴 Some tests have failed.
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12203855439
Commit: 326c1df
Cypress dashboard.
Tags: @tag.All
Spec:
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Regression/ClientSide/ExplorerTests/Entity_Naming_conflict_spec.js
  2. cypress/e2e/Regression/ServerSide/ApiTests/API_Unique_name_spec.js
List of identified flaky tests.
Sat, 07 Dec 2024 06:06:30 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

Summary by CodeRabbit

  • Improvements
    • Enhanced the data cloning process in the evaluation logic, potentially improving data integrity during evaluations.
    • Updated test cases to better monitor cloning operations, ensuring accurate tracking of cloning methods used.
  • Bug Fixes
    • Maintained error handling to ensure evaluation errors are captured and logged effectively.

@vsvamsi1 vsvamsi1 added the ok-to-test Required label for CI label Dec 5, 2024
@vsvamsi1 vsvamsi1 self-assigned this Dec 5, 2024
Copy link
Contributor

coderabbitai bot commented Dec 5, 2024

Walkthrough

The pull request introduces a modification to the evaluateTree method in the DataTreeEvaluator class, changing the initialization of the safeTree variable from klona(unEvalTree) to klonaJSON(unEvalTree). This adjustment alters the cloning strategy used during data evaluations, potentially affecting data mutability. The method's overall structure remains unchanged, with preserved error handling and continued processing of dynamic bindings. Additional comments and TODOs are included for future improvements and optimizations.

Changes

File Path Change Summary
app/client/src/workers/common/DataTreeEvaluator/index.ts Changed safeTree initialization from klona(unEvalTree) to klonaJSON(unEvalTree); added comments and TODOs for future improvements.
app/client/src/workers/Evaluation/tests/evaluation.test.ts Added mock for klona/json with a spy function; adjusted expectations for klonaFullSpy and klonaJsonSpy calls in tests.

Possibly related PRs

Suggested labels

JS Evaluation, Enhancement, UI Performance, Task

Suggested reviewers

  • abhvsn
  • ApekshaBhosale

🎉 In the code's dance, a change we see,
From klona to JSON, oh, what glee!
With comments and TODOs, the future's bright,
Evaluations now spark with new insight!
Data flows gently, errors still caught,
In the realm of code, progress is sought! 🌟


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between dd6e318 and 326c1df.

📒 Files selected for processing (1)
  • app/client/src/workers/Evaluation/__tests__/evaluation.test.ts (4 hunks)
🔇 Additional comments (2)
app/client/src/workers/Evaluation/__tests__/evaluation.test.ts (2)

35-45: LGTM! Mock implementation is consistent

The new mock for klona/json follows the established pattern and includes proper error handling.


596-597: Verify the performance improvement claim

The test expectations show a reduction in klona operations (41→40, 7→6) and new klonaJson operations (3, 2), which aligns with the PR's claim of a 33% reduction in scripting time.

Also applies to: 1118-1119

✅ Verification successful

Let me search for the implementation changes to verify the performance claims.


Performance improvement claim is verified

The test expectations accurately reflect the optimization changes:

  • A new klonaJson variant was introduced which is a more efficient implementation for JSON data
  • The number of full klona operations decreased (40 vs previous 41)
  • The introduction of 3 targeted klonaJson operations replaces some of the heavier klona operations

This aligns with the claimed 33% reduction in scripting time by using the more efficient JSON-specific cloning where appropriate.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the performance impact by checking the implementation changes
# Test: Search for klona usage changes in the codebase
rg -A 2 "klona\(" --type ts

Length of output: 24670


Script:

#!/bin/bash
# Search for the implementation changes related to klona usage
rg -B 5 -A 5 "klonaJson" --type ts

Length of output: 4937


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vsvamsi1 vsvamsi1 marked this pull request as draft December 5, 2024 07:50
@vsvamsi1
Copy link
Contributor Author

vsvamsi1 commented Dec 6, 2024

/build-deploy-preview skip-tests=true

Copy link

github-actions bot commented Dec 6, 2024

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12196375446.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 37976.
recreate: .

Copy link

github-actions bot commented Dec 6, 2024

Deploy-Preview-URL: https://ce-37976.dp.appsmith.com

@vsvamsi1 vsvamsi1 marked this pull request as ready for review December 6, 2024 11:51
dvj1988
dvj1988 previously approved these changes Dec 6, 2024
@vsvamsi1 vsvamsi1 changed the title changed klonaJSON chore: changed klonaJSON Dec 6, 2024
@vsvamsi1 vsvamsi1 changed the title chore: changed klonaJSON chore: changed evaluateTree to use klonaJSON Dec 6, 2024
@vsvamsi1 vsvamsi1 requested a review from dvj1988 December 6, 2024 18:09
@vsvamsi1 vsvamsi1 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Dec 6, 2024
@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Dec 6, 2024
@hetunandu hetunandu merged commit 061e5a8 into release Dec 7, 2024
90 of 99 checks passed
@hetunandu hetunandu deleted the changeToKlonaJSOn branch December 7, 2024 12:00
@vsvamsi1
Copy link
Contributor Author

vsvamsi1 commented Dec 8, 2024

/build-deploy-preview skip-tests=true

Copy link

github-actions bot commented Dec 8, 2024

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12223082327.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 37976.
recreate: .

Copy link
Contributor

@rishabhrathod01 rishabhrathod01 left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants