The performance of electron and photon reconstruction and identification in CMS during LHC Run 2 was measured using data collected in proton-proton collisions at $\sqrt{s}=13$ TeV in 2016--2018 corresponding to a total integrated luminosity
of 136 fb$^{-1}$. The energy resolution and energy scale measurements, together with the relevant identification efficiencies, remain stable throughout the full Run 2 data-taking period (2016--2018) and are similar to that of Run 1, despite the increased pileup and radiation damage. A global timing resolution of 200 ps is also measured for electrons from Z decays with the full Run 2 collision data.