Hi,
I have a web service returning edn representations containing many
java.util.Date values. Using a profiler, one Hot Spot is inside the
clojure.instant/print-date function. The relevant reflections warnings are:
Reflection warning,
instant.clj<https://github.com/clojure/clojure/blob/master/src/clj/clojure/instant.clj>:172:20
- reference to field get can't be resolved.
Reflection warning, instant.clj:174:15 - call to format can't be
resolved.
Reflection warning, instant.clj:174:5 - call to write can't be resolved.
Adding a ^ThreadLocal annotation to thread-local-utc-date-format and
a ^java.text.DateFormat to utc-format resolves all reflection warnings.
I tested the speedup with
(time (let [d (java.util.Date.)] (doseq [_ (range 100000)] (pr-str d))))
which takes about 1500 ms without the type annotations and about 500 ms
with type annotations.
A single web service access is speeded up from about 350 ms to 250 ms. The
response contains about 3000 java.util.Date values.
I could create a pull request if that would help. But I like to discuss the
change first. I have no CA so I use Clojure instead of Clojure Dev.
Alex
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.