liveBook · Manning

Chapter 7: Vibe performance engineering: when assumptions mislead

What you will learn in chapter 7 of Vibe Engineering

The introduction identifies false traffic assumptions and missed hot-paths as two ways performance work can add complexity without delivering production benefits, including when LLMs assist.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The introduction identifies false traffic assumptions and missed hot-paths as two ways performance work can add complexity without delivering production benefits, including when LLMs assist.

Key terms: premature optimization, expected traffic, service-level agreement (SLA), hot-path, expected production traffic

7.1 Mistakes of LLMs over-engineering performance improvements

The section explains why performance optimization without traffic data can add complexity without improving the application’s main workflow.

Key terms: expected throughput, maximum latency requirements, maintainable, code path, main workflow, complexity, false assumptions

7.1.1 The human solution

A sequential account lookup and a parallel version illustrate why performance changes should be measured against realistic workload assumptions before accepting added complexity.

Key terms: stream API, lazily, short-circuits, parallelStream(), work-stealing, ForkJoinPool common pool, stateless, splitting, JMH, performance benchmark

7.1.2 Vibe performance engineering solution

The section shows how an underspecified request led an LLM to over-engineer AccountFinder, and how realistic workloads and reliable benchmarks exposed the costs.

Key terms: AccountFinder, single-threaded, multithreading, premature optimization, accountConcurrent, accounts.indexOf(account), O(N^2), accountOptimized, ForkJoinPool, hot-path

7.1.3 Adding traffic expectations to the vibe performance engineering solution

The section shows how giving an LLM realistic traffic and data-size constraints changes its AccountFinder recommendation from parallel processing to a simpler, faster lookup strategy.

Key terms: expected traffic, 10K Accounts, Parallel Processing, HashMap-Based Lookup, a priori, a posteriori, benchmark, single-threaded, HashMap-based approach

7.2 Vibe performance engineering of the hot-path in code

The section shows why performance work should prioritize frequently executed code paths using measured traffic and mean execution time, rather than latency alone.

Key terms: input number of elements (N), empirical data, SLA, hot-path, p99 latency, mean latency, requests per second, total processing time

7.2.1 Understanding the Pareto principle in the context of software systems

Explains why performance work should focus on the small part of a codebase with the greatest impact, while using expected traffic to guide realistic performance tests.

Key terms: Pareto principle, 80/20 rule, linear behavior, core functionality, SLA requirements, expected upper bound of traffic, performance tests, real-world traffic

7.2.2 A word service with a potential hot-path

Introduces the word service used for later performance work and explains why its initial implementation avoids optimization before traffic or SLA requirements are known.

Key terms: word of the day, wordExists(), getWordOfTheDay(), dictionary, WordsService, premature optimizations, SLA, traffic, hot-path

7.2.3 Hot-path detection in your code

The section uses traffic-matched end-to-end tests and latency results to identify which Words endpoint deserves performance optimization.

Key terms: word-exists, word-of-the-day, Pareto principle, latencies, Gatling, Simulation, scenario, validate, HTTP response code, p99

7.3 Measuring the code

The section shows how internal timers turn a slow endpoint found by Gatling into a specific, measured code bottleneck.

Key terms: Gatling, black box, Dropwizard Metrics, MetricRegistry, wordExists(), timers, 99th percentile, loadFile, scan, hot-path

7.3.1 Measuring the code with vibe performance engineering techniques

The section uses an LLM-instrumented word service to show why performance optimization needs runtime evidence and metrics that distinguish the actual bottleneck.

Key terms: hot-path, WordsSimulation, wordExists(), runtime, traced version, Gatling benchmark, TracedWordsSimulation, load phase, scan phase, p99

7.3.2 Mistake of generating too much code

The section weighs the extra runtime insight from LLM-generated metrics against the maintenance cost of generating far more custom code than a simpler tracing solution.

Key terms: LLM-generated metrics code, tracing code, technical debt, standard library

7.4 Improvements for hot-path performance

The section compares eager and lazy caching for a word-existence hot path, explains how to choose and tune cache eviction, and reports the measured performance gains and cold-start cost.

Key terms: words file, static map, eager optimization, RAM, lazy cache, word-exists method, Guava’s LoadingCache, time eviction, traffic distribution, time intervals between requests

7.4.1 Improving performance with vibe performance engineering techniques

The section evaluates an LLM-generated cache optimization, showing a dramatic isolated performance gain while identifying memory, scope, observability, and maintenance trade-offs.

Key terms: JMH, wordsExist(), caching, eager caching, lazy caching, distribution of words, eager initialization, hot-path, words-exists, word-of-the-day

7.4.2 Comparing performance results based on Gatling simulations

The section compares Gatling results for eager and lazy caching, shows why dictionary-size constraints belong in the AI prompt, and recalculates which endpoint remains the performance hot path.

Key terms: Gatling, p99, eager loading, lazy loading, cache, dictionary, 10 MB, data constraints, eager, safety guardrail

7.5 Concluding thoughts

The section concludes that LLMs can deliver strong performance improvements when engineers supply realistic assumptions, measure the relevant code path, and judge the trade-offs.

Key terms: expected traffic, premature optimization, over-engineering, hot-path, benchmarking, metrics, trade-offs, memory limitations, startup time, eager vs lazy init

7.6 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 6: A scientific approach for validating LLM-based solutions Chapter 8: Evaluation is king: how to trust code you didn’t write →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.