If you search the Internet for connection diagrams for optocouplers, you will find that in the overwhelming majority of cases it is proposed to simply add a resistor. This is the simplest scheme and also the slowest. When the reaction speed is not satisfactory, it is proposed to install a faster optocoupler, but, firstly, fast optocouplers are expensive, and secondly, why not accelerate the fast optocoupler to an even higher speed?
So, what is the main problem of signal transmission through an optocoupler? Usually in the optocoupler there is a bipolar transistor at the output, and all bipolar transistors suffer from such a problem as the capacitance of the transitions. The main problem is created by the capacitance between the collector and the base; during transients, it is it that prevents the transistor from opening and closing quickly. This phenomenon is called the Miller effect. Back in the days of tube receivers, they figured out how to deal with it. The main idea is that the voltage between the base and the collector does not change, in this case, you do not have to waste time recharging the parasitic capacitance.
For example, let's compare how an optocoupler behaves during normal switching on and when switched on with constant voltage. In the first case, the container is charged so slowly that the output signal dangles somewhere near the middle.
, .
( ) , 0.1 . - 2-3 , 20-30 . , , , . - ( ).
, 100 / 1 /, . , ( ).
, , , 3 100 .
, , ? , , . , , . , , , .
, ( ) . , . , . ( , ). , . , .
Pairs of transistors are sold in the same package, so it should be pretty compact. The second silver bullet is ready, but you can see that the falling front is slightly behind. And finally, we came to gold: instead of a home-made comparator, we put an industrial one. Here they are, 10 ns fronts.
You can raise the input frequency to 100 MHz and see what happens in the end.
In principle, not bad, it is possible in production, although another problem arises here - such comparators are expensive.
PS: in the last circuit I hardly picked up the ratings, so do not hope that it will work for you at such a frequency.
The circuits were modeled in LTspice.