Searches for impulsive, astrophysical transients are often highly computationally demanding. A notable example is the dedispersion process required for performing blind searches for fast radio bursts (FRBs) in radio telescope data. We introduce a novel approach – efficient summation of arbitrary masks (ESAM) – which efficiently computes 1D convolution of many arbitrary 2D masks and can be used to carry out dedispersion over thousands of dispersion trials efficiently. Our method matches the accuracy of the traditional brute force technique in recovering the desired signal-to-noise ratio while reducing computational cost by around a factor of 10. We compare its performance with existing dedispersion algorithms, such as the fast dispersion measure transform algorithm, and demonstrate how ESAM provides freedom to choose arbitrary masks and further optimise computational cost versus accuracy. We explore the potential applications of ESAM beyond FRB searches.