Comments on: Optimising a slow build? You’re solving the wrong problem https://blog.mattwynne.net/2013/03/04/optimising-a-slow-build-youre-solving-the-wrong-problem/ Matt Wynne taking it one tea at a time Wed, 21 Aug 2019 12:53:52 +0000 hourly 1 https://wordpress.org/?v=6.2 By: Lukasz https://blog.mattwynne.net/2013/03/04/optimising-a-slow-build-youre-solving-the-wrong-problem/comment-page-1/#comment-2026 Tue, 05 Mar 2013 22:59:54 +0000 http://blog.mattwynne.net/?p=507#comment-2026 Having too many integration (read: long running) tests may also be an indicator of too much system coupling. That’s why it makes sense that increasing the proportion of unit tests would also have a shorter build.

So hypothetically, in your opinion, can build time be used as a proxy for coupling?

]]>
By: Matt https://blog.mattwynne.net/2013/03/04/optimising-a-slow-build-youre-solving-the-wrong-problem/comment-page-1/#comment-2007 Tue, 05 Mar 2013 00:25:53 +0000 http://blog.mattwynne.net/?p=507#comment-2007 In reply to Jem.

Well, I don’t know for sure. It doesn’t look like it at first glance, but if that was my system for real, I’m sure I’d have a few integration tests that covered some common scenarios, because the consequence of failure is so high. But I wouldn’t run those tests on every check-in of the code.

]]>
By: Jem https://blog.mattwynne.net/2013/03/04/optimising-a-slow-build-youre-solving-the-wrong-problem/comment-page-1/#comment-2004 Mon, 04 Mar 2013 23:07:30 +0000 http://blog.mattwynne.net/?p=507#comment-2004 I understand. Here’s a simplistic example.

I have a service that routes cars through traffic lights. I test that cars only go through lights when they are green.

I have a service that co-ordinates different traffic lights & test that intersecting lights are never green at the same time.

I can logically conclude that cars won’t crash in intersections … but I don’t test it, because that would be an integration test. Have I missed something important?

]]>
By: Myron Marston https://blog.mattwynne.net/2013/03/04/optimising-a-slow-build-youre-solving-the-wrong-problem/comment-page-1/#comment-2000 Mon, 04 Mar 2013 22:01:20 +0000 http://blog.mattwynne.net/?p=507#comment-2000 Good stuff, Matt.

To share another success story: I’ve been working on my current project for a year. This project is far more complex than any rails app I’ve ever worked on. I took what I had learned from Destroy All Software, Objects on Rails and GOOS and applied it to how we structured our code and how we tested it, and here’s where we’re at:

$ time bin/rspec spec/unit

Finished in 2.72 seconds (including 1 forced GC cycle(s), totalling 0.42926 seconds)
709 examples, 0 failures, 9 pending

Randomized with seed 2969

bin/rspec spec/unit –format progress 4.99s user 1.02s system 94% cpu 6.356 total

Running all of unit tests takes 6.35 seconds, and more than half of that is spent loading all the code.

The clearly defined interfaces between the components of our system have enabled us to make some large scale changes, all while getting virtually instantaneous feedback from our unit tests.

]]>
By: Matt https://blog.mattwynne.net/2013/03/04/optimising-a-slow-build-youre-solving-the-wrong-problem/comment-page-1/#comment-1999 Mon, 04 Mar 2013 21:46:37 +0000 http://blog.mattwynne.net/?p=507#comment-1999 In reply to Jem.

Jem, the idea is that if you have clearly defined contracts between your services, you only need to test a small number of interactions. Then thoroughly test the behaviour of the individual services. Testing everything from the outside leads to combinatorial explosion, and ultimately, madness.

]]>
By: Jem https://blog.mattwynne.net/2013/03/04/optimising-a-slow-build-youre-solving-the-wrong-problem/comment-page-1/#comment-1997 Mon, 04 Mar 2013 20:01:35 +0000 http://blog.mattwynne.net/?p=507#comment-1997 I have a 20 min build that I’d like to be at least halved, so I’m interested. But surely this is just about throwing away tests, right? When do they test the complexity of the interaction between the web services – i.e. real production scenarios?

Thanks

]]>
By: J. B. Rainsberger https://blog.mattwynne.net/2013/03/04/optimising-a-slow-build-youre-solving-the-wrong-problem/comment-page-1/#comment-1993 Mon, 04 Mar 2013 19:19:13 +0000 http://blog.mattwynne.net/?p=507#comment-1993 Programmers experience precisely the same problem when they substitute stubs/mocks for objects in their system in order to speed up the tests.

I encourage programmers to “reinvest” this their test speed profits to improve the design and reduce the number of dependencies. This increases cohesiveness and decreases code dependency on its context.

So it is for the build: reinvest the build speedup profits to split the system into smaller, more cohesive modules, each of which builds in seconds or minutes. Thanks for sharing.

]]>