Fork me on GitHub
#clojure-europe
<
2022-02-15
>
orestis07:02:31

Hello world 🙂

🎉 7
orestis07:02:58

@UK0810AQ2 You've asked for some flamegraphs...

orestis07:02:50

The first unoptimised version: Reflection dominates.

orestis07:02:34

The rendered itself was quite respectable, taking 2-3 seconds to render a 640x480 scene, but actually converting the result to a PPM file (using a StringBuilder) was another 8-9 seconds.

orestis07:02:22

After taking care of that, rendering now dominates - but a significant chunk of that was actually setting a pixel in the canvas array, because I was using the high-level set-selection! of core.matrix.

orestis07:02:11

Replacing that with just setting 3 r g b values pushes that down even further. Now I see two instance of sort-by taking a long time to sort just a handful of hits so that's the next place to optimise. Everything else seems to bottom out more or less to the matrix operations. Perhaps allocating points/vectors could be faster as that happens a lot. Perhaps using a macro or something would make sense.

orestis07:02:35

That's all for now 🙂 This is addicting. Next chapter is about adding shadows.

Ben Sless07:02:23

This is awesome 😄

Ben Sless07:02:38

and trimming down performance is addictive 😄

Ben Sless07:02:53

you can zoom in on each of the stacks. Maybe if you do it without mapcat you'll gain a huge speedup

pez07:02:16

I'd like som context, @U7PBP4UVA! 😃

pez07:02:39

Awesome.

orestis07:02:40

It's nice to coding to a spec. The book gives you some test cases, then guides on you on how to implement the algorithms. It's actually quite relaxing.

orestis07:02:49

I did most of the work while recovering from a cold.

thomas08:02:06

very cool indeed!

Ben Sless15:02:06

I was sure core matrix was already under org.clojure. Did you model the tuple as array?

orestis18:02:13

Yes, an array of 4 elements. Makes sense for all the following matrix multiplications. The book actually gives you guidance for all of this.

javahippie08:02:52

Morning!

❤️ 4
😍 1
mccraigmccraig09:02:31

no snow here, but quite a nice dawn sky

😍 3
genRaiy10:02:06

good morning

Michaël Salihi11:02:57

Morning! No snow here too, it's more a family trip to the sea in Normandy France 👋

❤️ 8
ordnungswidrig11:02:28

good morning

1
otfrom13:02:34

I took this yesterday. It is a bit windier today https://photos.app.goo.gl/V6W2axhg2vvfqYRAA

💨 2
1
otfrom13:02:44

going to get 2 named storms in the next 7 days

lread14:02:42

Good morning! Such visual splendour here today!

👍 1