Fast computation of demagnetization curves is essential for the computational design of soft magnetic sensors or permanent magnet materials. We show that a sparse preconditioner for a nonlinear conjugate gradient energy minimizer can lead to a speed up by a factor of 3 and 7 for computing hysteresis in soft magnetic and hard magnetic materials, respectively. As a preconditioner an approximation of the Hessian of the Lagrangian is used, which only takes local field terms into account. Preconditioning requires a few additional sparse matrix vector multiplications per iteration of the nonlinear conjugate gradient method, which is used for minimizing the energy for a given external field. The time to solution for computing the demagnetization curve scales almost linearly with problem size.