A neutron-spin experimental test of the quantum Zeno effect (QZE) is discussed from a practical point of view, when the nonideal efficiency of the magnetic mirrors, used for filtering the spin state, is taken into account. In the idealized case the number N of (ideal) mirrors can be indefinitely increased, yielding an increasingly better QZE. By contrast, in a practical situation with imperfect mirrors, there is an optimal number of mirrors, Nopt, at which the QZE becomes maximum: more frequent measurements would deteriorate the performance. However, a quantitative analysis shows that a good experimental test of the QZE is still feasible. These conclusions are of general validity: in a realistic experiment, the presence of losses and imperfections leads to an optimal frequency Nopt, which is in general finite. One should not increase N beyond Nopt. A convenient formula for Nopt, valid in a broad framework, is derived as a function of the parameters characterizing the experimental setup.