Signs of easing inflation and optimism over the economy boosted the Nasdaq to its strongest first-half performance since 1983.