According to Rober Shiller's long term data on the American stock market - from 1871 to 2019 the stock market advanced by 2.323% yearly on average without dividends, and 6.836% yearly on average with dividends reinvested. Both figures after inflation. That amounts to total gains of 2'900% and 1'780'000%, respectively.
https://dqydj.com/sp-500-return-calculator/
Dividends make a massive difference. It's in fact not a secondary but a primary driver of long term profit.