Skip to content

Instantly share code, notes, and snippets.

@borkdude
Last active November 6, 2018 16:27
Show Gist options
  • Save borkdude/8a977fa453c6ee26fefcecb4c88fe1f2 to your computer and use it in GitHub Desktop.
Save borkdude/8a977fa453c6ee26fefcecb4c88fe1f2 to your computer and use it in GitHub Desktop.
Penalty of instrumenting core specs

Performance penalty of instrumenting core specs

:cost is the mean time of 100k executions with instrumentation divided by the mean time without instrumentation.

:popularity is the frequency from this blog article: https://lispcast.com/100-most-used-clojure-expressions/

:penalty is the product of the above

One could now say: I want to instrument all core specs with a penalty lower than x.

Clojure

:fdef :penalty :cost :popularity
clojure.core/= 19657291 107 183713
clojure.core/apply 4141538 134 30907
clojure.core/assoc 1606825 55 29215
clojure.core/filter 1378077 127 10851
clojure.core/get 1261196 68 18547
clojure.core/count 1232380 43 28660
clojure.core/first 1139430 30 37981
clojure.core// 409683 51 8033
clojure.core/every? 269154 57 4722
clojure.core/juxt 88560 82 1080
clojure.core/fnil 76712 86 892

ClojureScript

:fdef :penalty :cost :popularity
cljs.core/= 22412986 122 183713
cljs.core/assoc 2512490 86 29215
cljs.core/get 2429657 131 18547
cljs.core/first 1329335 35 37981
cljs.core// 1261181 157 8033
cljs.core/filter 868080 80 10851
cljs.core/count 831140 29 28660
cljs.core/every? 188880 40 4722
cljs.core/fnil 24976 28 892
cljs.core/juxt 23760 22 1080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment