This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-26
Channels
- # announcements (3)
- # babashka (28)
- # beginners (21)
- # cider (29)
- # clojars (10)
- # clojure (14)
- # clojure-australia (3)
- # clojure-europe (48)
- # clojure-nl (3)
- # clojure-sanfrancisco (4)
- # clojure-uk (54)
- # clojurescript (34)
- # cryogen (12)
- # cursive (7)
- # datomic (14)
- # devcards (1)
- # fulcro (23)
- # helix (2)
- # java (5)
- # jobs (1)
- # kaocha (15)
- # malli (13)
- # minimallist (1)
- # off-topic (8)
- # pathom (7)
- # pedestal (1)
- # rdf (10)
- # reagent (18)
- # shadow-cljs (58)
- # spacemacs (3)
- # tools-deps (1)
- # vim (6)
- # xtdb (37)
What kinds of hash do you have problems with @raymcdermott?
(doseq [_ (range 5)]
(time (let [sha (MessageDigest/getInstance "SHA-256")]
(count (map (fn [x]
(->> x (.digest sha)))
(take 1000000 (repeatedly #(.getBytes (str "HASH" (rand-int Integer/MAX_VALUE))))))))))
"Elapsed time: 380.187311 msecs"
"Elapsed time: 376.734624 msecs"
"Elapsed time: 377.796685 msecs"
"Elapsed time: 378.096179 msecs"
"Elapsed time: 377.964661 msecs"
=> nil
(doseq [_ (range 5)]
(time (let [sha (MessageDigest/getInstance "SHA-256")]
(count (map (fn [x]
(->> x (.getBytes) (.digest sha)))
(take 1000000 (repeatedly #(str "HASH" (rand-int Integer/MAX_VALUE)))))))))
"Elapsed time: 1509.481255 msecs"
"Elapsed time: 1510.545895 msecs"
"Elapsed time: 1476.821262 msecs"
"Elapsed time: 1480.023988 msecs"
"Elapsed time: 1469.693934 msecs"
could it be reflection kicking in? maybe try a few type hints?
and/or https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/*warn-on-reflection*
you're right, type hints FTW - it could see it after str
but not in the function. Great spot - thanks!
@val_waeselynck re nginx from the other day ... using a cache like Varnish is often better if you have static assets cos then you don't need to split up your thinking between static and dynamic processing
@raymcdermott As @ben.hammond suggested, type hints solves the problem:
(doseq [_ (range 5)]
(time (let [sha (MessageDigest/getInstance "SHA-256")]
(count (map (fn [^String x]
(->> x (.getBytes) (.digest sha)))
(take 1000000 (repeatedly #(str "HASH" (rand-int Integer/MAX_VALUE)))))))))
great spot @ben.hammond
BTW, WTF were you doing replying in a thread @raymcdermott?
oh? are threads contraversial?
Threads vs No Threads reminds me of the noble tradition of Spaces vs Tabs and Emacs vs Vim ๐
hunter-gatherers vs farmer-herders
If you review the Richligious texts, you'll see he's very clearly against all forms of braiding. That includes threads!!!!!!!one!
@dominicm Keeping different discussions in different threads is clearly more decomplected than mixing all the topics together in the channel :P
To be fair, threads don't accurately mirror conversation. They mimic it, like a child playing with a toy oven. Conversations do more than simply splinter. They repeatedly splinter, and then they converge. They're far more like a git commit history.
Good hello!
Since you were discussing threads, I thought I would put in some multi-threaded printing. ng.