In recent years, the prospects of performing fundamental and applied studies at the next-generation high-intensity laser facilities have greatly stimulated the interest in performing large-scale simulations of laser interaction with matter with the account for quantum electrodynamics (QED) processes such as emission of high energy photons and decay of such photons into electron-positron pairs. These processes can be modelled via probabilistic routines that include frequent computation of synchrotron functions and can constitute significant computational demands within accordingly extended Particle-in-Cell (QED-PIC) algorithms. In this regard, the optimization of these routines is of great interest. In this paper, we propose and describe two modifications. First, we derive a more accurate upper-bound estimate for the rate of QED events and use it to arrange local sub-stepping of the global time step in a significantly more efficient way than done previously. Second, we present a new high-performance implementation of synchrotron functions. Our optimizations made it possible to speed up the computations by a factor of up to 13.7 depending on the problem. Our implementation is integrated into the PICADOR and Hi-Chi codes, the latter of which is distributed publicly (https://github.com/hi-chi/pyHiChi).