Premixed flames are susceptible to hydrodynamic and thermodiffusive instabilities that wrinkle the flame front and lead to complex multiscale patterns. They strongly impact the flame propagation and dynamics, increasing the speed of a laminar flame by several folds, easily as large as a factor of five for lean hydrogen flames at high pressure. The dispersion relation, which represents the growth rate of the different harmonic components of the perturbation of the flame front for different wavelengths, is useful to understand the dynamics during the linear phase of flame instabilities. In this work, an efficient and accurate approach based on a Fourier analysis of flame wrinkling is proposed to calculate the dispersion relation. Differently from the typical approach based on perturbing the flame with a single wavelength, the flame is perturbed with a spectrum of sine waves and their growth is followed with a spectral analysis. With the present method, the full dispersion relation is computed with a single simulation; this is significantly more efficient computationally than running a series of simulations with a single-wavelength perturbation for each point of the dispersion relation. It is shown that the presented approach is accurate and also solves an issue encountered when a single perturbation is imposed to compute the growth rate of large wavelengths. Several numerical and initialisation parameters, including resolution, domain size, and amplitude of the initial perturbation, are studied systematically and assessed.