Hi.

I was sent here from the Clojurians Slack after posting a question there 
about
the performance of clojure.spec (or actually cljs.spec).

After having specced most of my data structures and all of the functions in 
a
couple of namespaces, I am seeing my test suite taking 5 minutes to 
complete in
contrast to the 14 seconds it used before adding specs. I really enjoy the 
extra
confidence the specs give me, but their cost is breaking my familiar work 
flow.

I was told you are still collecting feedback about clojure.spec, so please
consider this a story of how a user new to spec might approach introducing 
specs 
to an existing application, and potentially a request for pointers to 
better ways of
doing things;

When clojure.spec was first announced I was actively looking for ways to 
make
refactorings and changes to the response formats of external services less
painful. Spec seemed to fit the bill perfectly, so as soon as the 
Clojurescript port 
was out, I dived in. 

Since this app is built around a single app-state atom, it seemed natural to
begin there.  Starting at the leaves I identified logical components, and 
wrote
specs for them. In the process I namespaced keywords, and put the spec
definitions into namespaces that were already there for dealing with that 
part
of the state.

When doing this, I worked from the REPL, feeding conform and explain the 
specs
and data from the live app in addition to conforming and non-conforming data
snippets that I typed out manually. 

So far, so good.

The next step was specing some functions. First, I picked a couple of small
namespaces (4-5 functions) to get going. At this point I wanted more 
automation,
so I added a call to instrument-all in my test runner. This was working 
fine,
and it helped me identify a couple of corner cases I had not considered. 
Great
stuff!

Next up was just typing out more specs, and then I could go on fixing bugs 
and 
adding features with a newfound confidence. I picked one of the larger 
namespaces (60 functions) next. I typed out specs for all the functions, 
spent 
some time tweaking this and that, and ultimately got everything running 
without 
complaints. But now running the tests takes so much time that I tend to not 
run 
the tests on save any longer. Instead I evaluate single tests of 
instrumented 
functions in Cider as I go along, but this takes away from the confidence 
that I 
first set out to gain. Also, I am worried that our CI service will struggle 
as I add 
even more specs. 

At this rate, I fear the full test suite will consume close to half an hour 
to
complete once all the planned specs are in place.

Is calling instrument-all before running tests not a recommended approach?  
How
do other people leverage their specs in their workflows? 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to