DistilCodeAll techniques

Technique 07 / 14 · Noise reduction

Log compressor

Find the one failing test in a run of hundreds without reading every passing line.

Interactive model

See the context change.

A test run with 600 passing tests and one failure.

Compressed9 lines

npm test

  1. 01

    ✕ checkout/api applies coupon

  2. 02

    Expected 90, received 100

  3. 03

    at applyCoupon (src/checkout/api.ts:41)

  4. 04

    1 warning: componentWillMount renamed

  5. 05

    Tests: 1 failed, 600 passed

Conceptual demonstration. Counts illustrate the flow, not measured production savings.

How it works

Less context. Same thread of work.

Test runners and build tools print a line per passing test, file or step. DistilCode’s log compressor, ported from headroom, keeps errors and failures (the first, the last and the highest-scored), deduplicated warnings, stack traces with runtime frames collapsed, summary lines, and a little context around each of them.

The total is then capped adaptively, so a huge log shrinks more than a short one. The original is kept for viewraw.

In practice

The operating loop

  1. 01

    Score the lines

    Failures, errors, warnings and summaries are found and ranked.

  2. 02

    Collapse the noise

    Passing lines fold away, duplicate warnings merge, runtime stack frames collapse.

  3. 03

    Cap adaptively

    Longer logs get a tighter budget, with context kept around what survives.