On Tuesday, June 18, 2013 9:58:20 AM UTC-7, Michael Klishin wrote:
>
> 2013/6/18 Tim Jones <[email protected] <javascript:>>
>
>> How do I get to near-java performance?
>
>
> Start by providing a snippet of your code and profiling.
>
> Great. Here's the context: iterate through a list of Product, and for
each Product, get a List<List<String>> which is URL info for that product.
Convert each List<String> to a vector and do a little processing on it.
Here is the code:
(defn- filter-link
"Format lang and cc into the link returned from the product."
[^List link]
[(.get link 0) (.get link 1) (.get link 2) (.get link 3)
(-> (.get link 4)
(URLDecoder/decode "UTF-8")
(format (.get link 1) (.get link 2)))])
(defn link-info
"Retrieve all link info from a product as a lazy-seq of vectors of
String. The function
handles parameter substitution within the URL"
[^Product p]
(map filter-link
(.getAllLinkInfo p @lib {"h_lang" "%1$s" "h_cc" "%2$s"})))
Here's a VisualVM screenshot. 500 products takes ~45s, with 18s spent in
one call:
<https://lh4.googleusercontent.com/-gLONfrNtJPs/UcDMkxHchuI/AAAAAAAAABU/GXqaevewpqs/s1600/clj-java-perf.png>
--
--
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.