Single-shot high-speed mapping photography is a powerful tool for studying fast dynamics in diverse applications. Despite much recent progress, existing methods are still strained by the trade-off between sequence depth and light throughput, errors induced by parallax, limited imaging dimensionality, and the potential damage by pulsed illumination. To overcome these limitations, we explore time-varying optical diffraction as a new gating mechanism to obtain ultrahigh imaging speed. Inspired by the pulse front tilt-gated imaging and the space-time duality in optics, we embody the proposed paradigm in the developed diffraction-gated real-time ultrahigh-speed mapping (DRUM) photography. The sweeping optical diffraction envelope generated by the inter-pattern transition of a digital micromirror device enables sequential time-gating at the sub-microsecond level. DRUM photography can capture a transient event in a single exposure at 4.8 million frames per second. We apply it to the investigation of femtosecond laser-induced breakdown in liquid and laser ablation in biological samples.