An Op-Amp wired as a comparator can change many wave form (including sine wave ) into square wave but I asked about correct feedback resistor and input resistor values of an op-amp here and we came to the conclusion that these values should be small to avoid capacitance effects.
In an Op-Amp in comparator design, the feedback resistor is around tens of mega ohms and this causes many parasitic effects as well as low pass filter effect that diminishes the output.
In practice, I used AD826 as a comparator and I can see it makes a clean square wave in frequencies less than 1MHz but distortions start in higher frequencies until the output is nothing except a background noise in 5MHz.
What is the best design for an Op-Amp as a comparator in higher frequencies? I am using this simple design (pin numbers are not related to AD826):