The world’s richest places tend to be dense, with well-educated residents and a free-market-orientation (or tax havens or oil-rich) — think of New York and the Bay Area, of Singapore, Hong Kong and the Netherlands. Without a stock of skilled workers and a relatively open marketplace, density’s impact on growth and productivity will be limited.

What is it exactly that dense cities are doing? Consider a simple example. Suppose that within a population one person in 100 develops a taste for Vietnamese cuisine, and suppose that a Vietnamese restaurant needs a customer base of 1,000 people to operate profitably. In a city of 10,000 residents, there aren’t enough people to support a Vietnamese restaurant. The only restaurants that can operate profitably are those appealing to considerably more than one in 100 people — restaurants offering less daring fare. In a city of 10,000 people, there is little room for specialization, and less for experimentation.

A city of one million people, by contrast, can support multiple Vietnamese restaurants. Not only will this larger city enjoy a specialty cuisine unavailable in less populous places, but its ability to support multiple producers of this cuisine allows for competition, improving the price and quality.

A city with multiple Vietnamese restaurants may attract sellers of the fresh ingredients used in Vietnamese cooking, who then invest in distribution of those products in the larger city. This, in turn, attracts the sort of discerning eaters who favor authentic, high-quality Vietnamese food, reinforcing the concentration of Vietnamese eateries. The larger market facilitates competition, which again boosts quality and reduces prices. This is good for consumers. But competition also means better service from suppliers and growth in the consumer market, which is good for the restaurants. The result is a stronger, more productive and higher-quality microeconomy than in the city of 100,000, where only one Vietnamese restaurant can survive, or the town of 10,000, where there is none at all.

Density doesn’t work without talent. A small market may only support restaurants producing food that caters to a broad range of tastes. These restaurants will have to hire generalists — cooks who can produce a broad range of cuisines. Specialization and fine-tuning of one’s skills aren’t rewarded; too few patrons will have the specific taste for the particular cuisine to appreciate the quality. Time spent nailing down the nuances of one cuisine is time a chef isn’t using to maintain a good-enough command of a broad range of dishes.

In the larger market, supporting multiple niche cuisines, the calculus is different. Because there may be multiple Vietnamese restaurants competing for patrons, mastery of that specific style is necessary to maintain an edge against the competition. This is particularly true as the concentration of Vietnamese restaurants is likely to attract devotees of the cuisine with a well-developed knowledge of and taste for it. Hence, the larger marketplace pushes for, rather than against, specialization.

Meanwhile, a worker hoping to make a living as a Vietnamese chef will have a much easier time of things in the larger city. Labor turnover may be greater — if there’s only one Vietnamese restaurant in a town, then head-chef spots may only rarely open up — and so the odds of finding employment are higher. The larger city also provides insurance against bad fortune. If you’re a Vietnamese chef working at the one Vietnamese restaurant in a town and the one Vietnamese restaurant goes bankrupt, then you’re obviously in a tough economic situation. You must either take another job for which you’re less qualified, which may mean a reduction in compensation, or move. In the larger city, by contrast, competing restaurants can absorb and reemploy the labor and resources of defunct competitors.