Transistor switch - extra resistor required?
Is this extra resistor necessary and what does it do in this circuit?


The resistor that goes from pin 4 to Vcc can help speed up the switching process. If you need faster switching this resistor will help because at the moment, when you turn off Q1, the charge on the photodiode's internal capacitance will take time to reduce without a shunt resistor in parallel with the diode.

You may need it in your application but unfortunately the data sheet doesn't give any hints on how to size it.