clojure-europe

For people in Europe... or elsewhere... UGT https://indieweb.org/Universal_Greeting_Time
dharrigan 2020-11-26T07:14:10.048200Z

Good Morning!

plexus 2020-11-26T07:31:18.048500Z

Good morning!

dominicm 2020-11-26T07:58:09.048700Z

Morning

raymcdermott 2020-11-26T08:06:14.048900Z

morning

raymcdermott 2020-11-26T08:07:21.050100Z

was thinking about the overhead of hashes last night, as you do

dominicm 2020-11-26T08:10:18.052800Z

What kinds of hash do you have problems with @raymcdermott?

raymcdermott 2020-11-26T08:11:01.053100Z

(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"

raymcdermott 2020-11-26T08:11:27.053600Z

placement of .getBytes makes a huge performance difference

raymcdermott 2020-11-26T08:12:04.054100Z

1m hashes in 380ms or 1500ms

raymcdermott 2020-11-26T08:12:13.054300Z

thoughts?

raymcdermott 2020-11-26T08:14:29.055Z

but also, I see your 🌿 joke there @dominicm ...

raymcdermott 2020-11-26T08:20:52.059300Z

@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

πŸ‘ 1
raymcdermott 2020-11-26T08:22:09.060200Z

I think of like memoize at a system level

thomas 2020-11-26T08:24:54.060400Z

mogge

2020-11-26T08:33:39.060500Z

could it be reflection kicking in? maybe try a few type hints?

simongray 2020-11-26T08:34:59.060800Z

morning

slipset 2020-11-26T08:42:05.061500Z

@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)))))))))

raymcdermott 2020-11-26T08:42:10.061600Z

you're right, type hints FTW - it could see it after str but not in the function. Great spot - thanks!

πŸ‘ 2
raymcdermott 2020-11-26T08:42:28.061900Z

yes

raymcdermott 2020-11-26T08:42:45.062100Z

great spot @ben.hammond

raymcdermott 2020-11-26T08:42:58.062600Z

and a :face_palm::skin-tone-3: for me πŸ™‚

slipset 2020-11-26T08:43:08.062900Z

BTW, WTF were you doing replying in a thread @raymcdermott?

raymcdermott 2020-11-26T08:43:29.063200Z

it's Ben, he gets a pass

raymcdermott 2020-11-26T08:45:38.064400Z

also I allow myself to be inconsistent and hypocritical

2020-11-26T08:46:44.064800Z

oh? are threads contraversial?

dominicm 2020-11-26T08:55:47.065500Z

Yeah, we don't like 'em round here. They unravel too easily.

raymcdermott 2020-11-26T09:03:02.066700Z

Too many clicks for my liking but no rules

simongray 2020-11-26T09:16:22.067Z

I like threads… πŸ˜•

dharrigan 2020-11-26T09:29:36.067600Z

Threads vs No Threads reminds me of the noble tradition of Spaces vs Tabs and Emacs vs Vim πŸ™‚

πŸ˜„ 2
2020-11-26T09:30:47.068100Z

hunter-gatherers vs farmer-herders

raymcdermott 2020-11-26T09:31:42.069700Z

Threads are the type system of Slack

dominicm 2020-11-26T09:31:45.069900Z

If you review the Richligious texts, you'll see he's very clearly against all forms of braiding. That includes threads!!!!!!!one!

simongray 2020-11-26T09:42:21.071600Z

@dominicm Keeping different discussions in different threads is clearly more decomplected than mixing all the topics together in the channel :P

dominicm 2020-11-26T09:45:05.073900Z

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.

raymcdermott 2020-11-26T09:50:41.074200Z

Oh Jesus

ordnungswidrig 2020-11-26T12:51:45.074800Z

Good hello!

2020-11-26T13:08:26.075Z

morning

borkdude 2020-11-26T13:09:34.075200Z

morni

borkdude 2020-11-26T13:09:53.075700Z

Since you were discussing threads, I thought I would put in some multi-threaded printing. ng.

2020-11-26T13:14:41.076100Z

yep, my dumb logging does that (if I don't use tap>)

raymcdermott 2020-11-26T14:12:56.076900Z

apropos threads: the first person to say fractal is gonna get it, right between the parens

mpenet 2020-11-26T14:27:59.077600Z

why the fractal hate?

mpenet 2020-11-26T14:28:05.077800Z

oops

2020-11-26T14:54:07.077900Z

is it really pretty in an unexpectedly mathematical way?

2020-11-26T14:54:17.078100Z

this feels like a real problem given your status

2020-11-26T15:03:39.078800Z

may the parens of ❀️ protect us all from hate πŸ™‚

raymcdermott 2020-11-26T16:44:52.079400Z

( hehe )