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

Improve resource sync performance #8674

Merged
merged 2 commits into from Mar 25, 2024
Merged

Conversation

vlaaad
Copy link
Contributor

@vlaaad vlaaad commented Mar 13, 2024

Fixes #8595

(defn- combine-snapshots [snapshots]
(reduce
(fn [result snapshot]
(if-let [collisions (seq (clojure.set/intersection (resource-paths result) (resource-paths snapshot)))]
(if-let [collisions (not-empty (map-intersection (:status-map result) (:status-map snapshot)))]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very important addition! On my machine, this change brought down resource sync time from 4.5 to 2 seconds.

(make-debugger-snapshot workspace)
(make-library-snapshots new-library-snapshot-cache lib-states)))
:snapshot-cache new-library-snapshot-cache}))
(resource/with-defignore-pred project-directory
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very important addition (especially for Windows) — we no longer check canonical path and mtime of .defignore for every file.

Comment on lines -60 to +65
:status-map (into {} (map (fn [resource]
(let [path (resource/proj-path resource)
version (str zip-file-version ":" (crc path))]
[path {:version version :source :library :library uri-string}]))
flat-resources))}))
:status-map (into {}
(map (fn [resource]
(let [path (resource/proj-path resource)
version (str zip-file-version ":" (crc path))]
[path {:version version :source :library :library uri-string}])))
flat-resources)}))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a minor change that was easy to do: use transducers instead of lazy seqs.

Comment on lines -194 to +208
(into {} (map (juxt resource/proj-path identity) (resource/resource-list-seq (:resources snapshot)))))
(into {} (map (juxt resource/proj-path identity)) (resource/resource-list-seq (:resources snapshot))))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a minor change that was easy to do: use transducers instead of lazy seqs.

Comment on lines -122 to +126
(let [prefixes (into
#{}
(filter #(string/starts-with? % "/"))
(string/split-lines (slurp defignore-file)))]
(let [prefixes (into []
(comp
(filter #(string/starts-with? % "/"))
(distinct))
(string/split-lines (slurp defignore-file)))]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a minor change that was easy to do: use distinct vec instead of set for faster ignored path check. Very minor effect on performance.

@vlaaad vlaaad requested a review from matgis March 14, 2024 09:37
Copy link
Contributor

@matgis matgis left a comment

Choose a reason for hiding this comment

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

Changes look good, apart from you fixing a typo now makes a comment inaccurate due to the field mentioned actually being misspelled in Bob. 😞

I'll let you decide how you want to deal with it.

;; If you change something here, plese change it there as well
;; Search for excluedFilesAndFoldersEntries.
;; If you change something here, please change it there as well
;; Search for excludedFilesAndFoldersEntries.
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, the name of the field is misspelled in Bob. 😞

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh no

Copy link
Contributor

Choose a reason for hiding this comment

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

it was me 😳

@vlaaad vlaaad merged commit 2d6a359 into hotfix-1.6.2 Mar 25, 2024
22 checks passed
@vlaaad vlaaad deleted the hotfix-1.6.2-resource-sync branch March 25, 2024 10:34
vlaaad added a commit that referenced this pull request Mar 25, 2024
* Improve resource sync performance

Fixes #8595

* Bring back the misspelling
vlaaad added a commit that referenced this pull request Mar 25, 2024
* Improve resource sync performance

Fixes #8595

* Bring back the misspelling
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.

None yet

3 participants