-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
[java] Improve Java parsing performance #237
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -323,14 +323,14 @@ | |
(when-let [^DocletEnvironment root (parse-java path (module-name klass))] | ||
(try | ||
(let [path-resource (io/resource path)] | ||
(assoc (->> (.getIncludedElements root) | ||
(filterv #(#{ElementKind/CLASS | ||
ElementKind/INTERFACE | ||
ElementKind/ENUM} | ||
(.getKind ^Element %))) | ||
(mapv #(parse-info % root)) | ||
(filterv #(= klass (:class %))) | ||
(first)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because of eagerness, this code invoked |
||
(assoc (some #(when (#{ElementKind/CLASS | ||
ElementKind/INTERFACE | ||
ElementKind/ENUM} | ||
(.getKind ^Element %)) | ||
(let [info (parse-info % root)] | ||
(when (= (:class info) klass) | ||
info))) | ||
(.getIncludedElements root)) | ||
;; relative path on the classpath | ||
:file path | ||
;; Legacy key. Please do not remove - we don't do breaking changes! | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -476,8 +476,7 @@ | |
[ns sym] | ||
(when-let [ns (find-ns ns)] | ||
(->> (vals (ns-imports ns)) | ||
(map #(member-info (-> ^Class % .getName symbol) sym)) | ||
(filter identity) | ||
(keep #(member-info (-> ^Class % .getName symbol) sym)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is minor. |
||
(distinct)))) | ||
|
||
(defn trim-one-dot | ||
|
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.
This is a bit better due to laziness, but it will still realize at least a 32-chunk of
parse-info
s before doingfirst
on them.