A method is demonstrated to rapidly calculate the shapes and properties of quasi-axisymmetric and quasi-helically symmetric stellarators. In this approach, optimization is applied to the equations of magnetohydrodynamic equilibrium and quasisymmetry, expanded in the small distance from the magnetic axis, as formulated by Garren & Boozer [Phys. Fluids B, vol. 3, 1991, p. 2805]. Due to the reduction of the equations by the expansion, the computational cost is significantly reduced, to times of the order of 1 cpu second, enabling wide and high-resolution scans over parameter space. In contrast to traditional stellarator optimization, here, the cost function serves to maximize the volume in which the expansion is accurate. A key term in the cost function is $\| \boldsymbol {\nabla }\boldsymbol B \|$, the norm of the magnetic field gradient, to maximize scale lengths in the field. Using this method, a database of $5\times 10^5$ optimized configurations is calculated and presented. Quasisymmetric configurations are observed to exist in continuous bands, varying in the ratio of the magnetic axis length to average major radius. Several qualitatively new types of configuration are found, including quasi-helically symmetric fields in which the number of field periods is two or more than six.