liveBook · Manning

Measurement

As explained in Vibe Engineering

Measurement is the systematic quantification of attributes or outcomes using defined observations or metrics.

A performance problem can look obvious from the code while its real cost remains hidden. Measurement replaces assumptions with defined observations: exercise a representative workload, record relevant metrics, and use the results to decide where to investigate. section 7.3 section 7.3.1

A load test can identify a slow endpoint without revealing which internal operation is responsible. Instrument selected stages separately, rerun the workload, and compare invocation counts, averages, and percentiles. Choose granularity carefully: measuring every path can affect performance, and unnecessary metrics can obscure the signal. section 7.3 section 7.5

Finding the slow stage

For a word-existence endpoint, separate timers measure scanner creation and the subsequent word scan. In one run, both recorded 1,200 invocations; the 99th percentile was about 0.00073 seconds for loadFile and 0.0786 seconds for scan. That comparison directs investigation toward scanning rather than treating the endpoint as an indivisible operation. section 7.3

Listing 7.11 Measuring the word-exists logic
@Override
public boolean wordExists(String word) {
   Timer loadFile = metricRegistry.timer("loadFile");
   try (Scanner scanner = loadFile.time(() -> new
      Scanner(filePath.toFile()))) { #A
      
      Timer scan = metricRegistry.timer("scan");
      return scan.time( #B
          () -> {
            while (scanner.hasNextLine()) {
              String line = scanner.nextLine();
              if (word.equals(line)) {
                return true;
      }
      return false;
    });
  } catch (Exception e) {
      throw new RuntimeException("Problem in wordExists for word: " + word, e);
  }
}

The listing shows where the two timers surround scanner creation and the scan loop. section 7.3

AI can help add instrumentation, but static guesses and generated metrics still need runtime verification. Supply the expected traffic, run the benchmark, inspect the numbers, and give those results back before requesting optimization. Keep changes focused on the measured hot path; broad rewrites add review, deployment, and monitoring costs. section 7.3.1 section 7.5

Measure outcomes as well as activity. Review capacity released by automation is not itself delivered value: record it as capacity, then measure what it produces. Likewise, perceived developer speed is a poor substitute for wall-clock time and error count. section 10.5.3 section 1.1

How Vibe Engineering covers it

How deep it goes
Works through workload testing, targeted timers, metric interpretation, and instrumentation overhead; also recommends empirical governance calibration.
Examples
Compares scanner-creation and scan timings for a word-existence endpoint, and tracks whether released review capacity produces features.
What you can do after
Apply it via Gatling and Dropwizard Metrics to investigate a workload’s hot path and assess instrumentation tradeoffs.
How it connects
Connects measurement to load testing, performance optimization, instrumentation, and governance.

Also explained in

Compare how 6 books explain measurement →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Vibe Engineering. The section links point to the parts of the book it draws on.