TSL235R inconsistent output

millis() isn't anything like accurate enough, use micros().

Also you must protect your code from the interrupt routine writing the variable
pulses. Its a 4 byte variable so the main-line code will read 4 bytes from the
memory and the interrupt routine could sneak in between those reads.

You read the value thus:

  noInterrupts () ;
  unsigned long copy = pulses ;
  interrupts () ;

The other issue you have is you zero the value of pulses in the main code.

Don't do this, its losing accuracy.

Just record the value of pulses that you copied and subtract it next time from
the copy to give an accurate count of the number of times the ISR ran.