Benchmarking Clojure Application

This is a snippet for benchmarking clojure application which I have used quite often in clojure applications at my job. First an introduction to the tools: clj-asyc-profiler: for flamegraphs and call graph. criterion: for statistically correct benchmarking. tufte: application level profiling. from this we can keep both #1 and #2 in separate profile just for benchmarking and #3 must be included in the :default profile, otherwise it would defeat its purpose....

March 3, 2024 · 5 min · Upendra Upadhyay

Exploring Resource Directory in Clojure

I was trying to explore the files available in resource directory and read only the .txt files available. suppose that I have these files in resources: resources/ └── hello ├── a.txt ├── b.txt └── c.not-txt and this is the clojure code that I have to read the files: (ns jar-resource-read.core (:require [clojure.java.io :refer [resource file]]) (:gen-class)) (defn read-all-txt-files [] (let [txt-files (->> (resource "hello") (file) (file-seq) (filter #(-> %1 (.getName) (....

March 2, 2024 · 2 min · Upendra Upadhyay