This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-01
Channels
- # adventofcode (170)
- # announcements (3)
- # babashka (1)
- # beginners (25)
- # cherry (1)
- # cider (3)
- # clj-kondo (5)
- # cljsrn (9)
- # clojure (27)
- # clojure-art (2)
- # clojure-europe (11)
- # clojure-nl (1)
- # clojure-norway (26)
- # clojure-sweden (2)
- # clojure-uk (5)
- # code-reviews (12)
- # component (8)
- # conjure (1)
- # data-science (2)
- # hyperfiddle (6)
- # malli (5)
- # off-topic (65)
- # overtone (34)
- # polylith (3)
- # re-frame (2)
- # reagent (2)
- # releases (3)
- # rum (1)
- # shadow-cljs (2)
- # slack-help (8)
- # sql (8)
- # squint (100)
- # thejaloniki (3)
- # tools-build (16)
- # vim (7)
- # yamlscript (1)
does anyone have libraries or utilities to measure start and stop times of individual components? i'm researching why our test suite is slow and two parts stood out to me: roughly 0.5 seconds to in component/start
and roughly 1 second in component/stop
, which we're calling as :each
fixtures in all our test files.
We have "slow" start
/`stop` times too but we did two things to improve test suite times:
• We switched to :once
fixtures
• We added a per-suite fixture by tapping into the test runner itself and added start
/`stop` there for some parts of the suite (`start` is idempotent, but the trick to prevent stop
tearing things down was to track in the start
function whether the system was already started and then have stop
do nothing if start
hadn't done anything -- allowing the system to be long-lived)
The main thing for us, I think, was starting the various connection pools for the databases (we have four main SQL databases and we have a couple of extra readonly pools as well), so having all that happen only one per test suite made a big difference.
that sounds really good. our test system is kind of a mess (we're calling migratus/migrate
every start up, lol) but the biggest issue is starting and stopping everything every deftest. i'll see if i can implement something similar!
do you have allowance to share any of that code?
Unfortunately, it's pretty tied into our app-specific code.
We're using Polylith, which has per-project fixtures in addition to the per-namespace/per-test which clojure.test
provides.
dang, that's cool tho
good way to think about it