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

Store coupling file info on disk #33

Closed
gopar opened this issue Feb 16, 2023 · 3 comments · Fixed by #35
Closed

Store coupling file info on disk #33

gopar opened this issue Feb 16, 2023 · 3 comments · Fixed by #35

Comments

@gopar
Copy link
Contributor

gopar commented Feb 16, 2023

Would be nice to save a cached version of the coupling results.

Thoughts:
when calculating the coupling results it would be nice to take a snapshot of the current head commit and branch.
Reasoning:

  • if head commit changes, then cached results might not be valid
  • Same reasoning for current branch
  • if we match on both of these, then retrieve results, otherwise re-calculate
  • We could save on directory {$code_compass_home}/.coupling_files/commit_hash ? ¯_(ツ)_/¯

Not sure if this makes sense or is too ambitious.

@ag91
Copy link
Owner

ag91 commented Feb 17, 2023 via email

@gopar
Copy link
Contributor Author

gopar commented Feb 17, 2023

When I run code-compass-find-coupled-files it usually takes a good amount of time to finish. I tested out on smaller projects and it would finish pretty fast. I wouldn't want to wait multiple minutes every time i restart emacs, would rather have cache of some sort to read from disk if nothing has changed since last time.

@ag91
Copy link
Owner

ag91 commented Feb 22, 2023

that makes sense. It seems all we need is to serialize at this point https://github.com/ag91/code-compass/blob/main/code-compass.el#L896
with something like

(defun store-data (variable value)
  "Persist VARIABLE to given VALUE for the next session."
  (write-region (pp ??) nil "somfile")

That would serialize by project. The branch capabilities would need some extension, but probably that would be a good first step.
The other thing is to add an argument to reset this local cache, in case it is giving unexpected results. Probably also a message telling we are using a cached result would help users finding out why things may be surprising.
Would you like to give it a go? In my little free time, I am trying to get this to Melpa at the moment, so this may have to wait some time.

@ag91 ag91 closed this as completed in #35 Feb 26, 2023
ag91 added a commit that referenced this issue Mar 2, 2023
This modifies the key for the hashmap to include the revision hash.
This makes some of the code introduced for #33 redundant. I removed
also the backend check because that concern is cross cutting and I
would need a significant refactor of code if anybody ever asks for
support for other VCS.

Closes #38.
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 a pull request may close this issue.

2 participants