Nvidia’s shares have risen 19% this year, compared with an 8% gain for the S&P 500 and Philadelphia Semiconductor Index’s 57% gain.