liveBook · Manning

Linear search

As explained in Vibe Engineering

Linear search is a search algorithm that examines elements sequentially until a matching element is found or the collection is exhausted.

Linear search checks items sequentially. For roughly 10,000 accounts, that simple access pattern can finish faster than parallel processing because thread management, coordination, synchronization, and context switching outweigh the search work. section 7.1.3

Treat linear search as a measured baseline rather than an automatic optimization target. Expected traffic and collection size determine whether its simplicity is sufficient or whether an indexed lookup is justified. section 7.1.3

Account lookup benchmark

An AccountFinder benchmark compares linear, parallel, and HashMap-based lookup strategies. With 10,000 accounts, linear search remains extremely fast, while the HashMap approach is orders of magnitude faster after indexing account identifiers. section 7.1.3

How Vibe Engineering covers it

How deep it goes
Compares runtime tradeoffs and stops short of detailing linear-search implementation internals.
Examples
Uses 10,000 accounts, AccountFinder strategies, and JMH comparisons as concrete performance examples.
What it assumes
Assumes familiarity with performance comparisons and requires expected traffic and data size to judge suitability.
What you can do after
Evaluate lookup strategies by supplying traffic and data-size assumptions, then verifying claims with benchmarks.
How it connects
Connects linear search with parallel processing, HashMap lookup, algorithm optimization, and benchmarking.

Also explained in

Compare how 7 books explain linear search →

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.