We're nearing the end of the second quarter, with the notching a gain of nearly 3% this quarter and 16% for the first half.

But the gains are not evenly distributed. Some of the largest stocks by market capitalization are leading the way.

Call it the triumph of indexing: A few companies have gotten so big that they are essentially becoming the market, and when they do well, the markets do well.

You can see this in the distribution of returns. The S&P 500 may be up 2.9%, but an equal-weighted index of the S&P 500 is up only 1.8%, suggesting the largest companies are pulling the averages up. Second, midcaps are flat and the S&P Small Cap Index is down 1.8%.

For the quarter, five of the largest stocks contributed 30% of that S&P 500 gain:

Think about that — five companies, out of almost 500, contribute more than 30% of the gains.

Does that mean everything else was down? Of course not. In the second quarter, 313 of the 500 were up, 188 were down. But some very large companies had some big losses.

For example, Intel, Alphabet and Exxon Mobil combined dragged down the S&P 500 by 7.4%.

So it can work in reverse. The biggest companies can also drag down a market-cap-weighted index.

What's it all mean?

"A lot of the super big-caps are continuing to grow, which is surprising because when you get that big, it's harder to grow," said Howard Silverblatt, who tracks indexing trends for S&P Global.

Why is this happening? Because growth is hard to come by.

"In a slow growth environment people continue to pay up for organic growth wherever they can find it," said Alec Young, managing director of global markets research for FTSE Russell. "And the best place to find it lately has been among the big blue chips, primarily in the technology and consumer discretionary sectors."

Here's a simple way to understand how dominate the largest companies have become.

Suppose the top 50 stocks in the S&P 500 by market cap were all up 1% on the quarter. And let's assume that all the other stocks in the S&P 500 — all 450 of them — were down 1% on the quarter.

Would the S&P 500 be up or down?

It would seem intuitive that with 50 stocks up and 450 down, the S&P would be down, right?

Wrong. The S&P 500 would be flat. That's how powerful the biggest names have become. That's how much the world is willing to pay for growth. At any price.