Skip to content

Instantly share code, notes, and snippets.

;; Gaussian sum!
user=> (crit/with-progress-reporting (crit/quick-bench (/ (* (+ 1 99999) 99999) 2)))
Warming up for JIT optimisations 5000000000 ...
compilation occured before 333366 iterations
Estimating execution count ...
Sampling ...
Final GC...
Checking GC...
WARNING: Final GC required 8.548926352381509 % of runtime
Finding outliers ...
@4mitch
4mitch / day3part1.clj
Created December 15, 2019 22:13
Advent of Code '19 day 3 part 1
(defn step [s]
[(keyword (subs s 0 1)) (Integer/parseInt (subs s 1))])
(defn get-dots [dots action]
(let [[op len] action
dots dots
from (last dots)
[from_x from_y] from
f+x (partial + from_x 1)
f-x (partial - from_x 1)
@4mitch
4mitch / lein-different-jvm.sh
Created December 25, 2019 09:43 — forked from camsaul/lein-different-jvm.sh
Run lein with different JVM
#!/bin/bash
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home lein run
@4mitch
4mitch / fibers.clj
Created December 25, 2019 21:38
JDK 14 - Project Loom virtual threads (ex-fibers) test - CAS vs LongAdder performance comparison
(ns me.core
(:import [java.util.concurrent.atomic LongAdder]
[java.util.concurrent CountDownLatch]))
(defmacro fiber [& body]
`(.. (Thread/builder)
(virtual)
(task (fn [] ~@body))
; (build)
@4mitch
4mitch / .block
Created March 1, 2021 09:15 — forked from vasturiano/.block
Timelines Chart
height: 700
scrolling: yes