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

[Tapioca Add-on] Optimize File Save Handling #2052

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

alexcrocha
Copy link

@alexcrocha alexcrocha commented Oct 18, 2024

Motivation

Currently, each file save triggers DSL generation, even when there are no code changes. This leads to unnecessary processing. This PR addresses the issue by optimizing the save handling process.

Implementation

Implemented a checksum-based approach using Zlib.crc32. By calculating and storing file checksums, we can skip DSL generation for unchanged files, reducing redundant processing.

@alexcrocha alexcrocha added the enhancement New feature or request label Oct 18, 2024
By leveraging file checksums using `Zlib.crc32`, we can avoid triggering
the DSL generation process for files that have not changed.
@alexcrocha alexcrocha changed the title [WIP] Handle repeat saves Optimize File Save Handling in Tapioca LSP Addon Oct 23, 2024
@alexcrocha alexcrocha marked this pull request as ready for review October 23, 2024 20:54
@alexcrocha alexcrocha requested a review from a team as a code owner October 23, 2024 20:54
current_checksum = Zlib.crc32(content).to_s

if change[:type] == Constant::FileChangeType::CHANGED && @file_checksums[path] == current_checksum
$stderr.puts "File has not changed. Skipping #{path}"
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be a little noisy to show every time, but we can keep it for now.

Copy link
Author

Choose a reason for hiding this comment

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

Good point. Let's monitor it and I'll remove if it's too much.

@alexcrocha alexcrocha changed the title Optimize File Save Handling in Tapioca LSP Addon [Tapioca Add-on] Optimize File Save Handling in Tapioca LSP Addon Oct 24, 2024
@alexcrocha alexcrocha changed the title [Tapioca Add-on] Optimize File Save Handling in Tapioca LSP Addon [Tapioca Add-on] Optimize File Save Handling Oct 24, 2024
@alexcrocha alexcrocha merged commit 258e290 into tapioca-addon-feature-branch Oct 24, 2024
14 of 28 checks passed
@alexcrocha alexcrocha deleted the ar/handle-repeat-saves branch October 24, 2024 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants