Picosecond optical switching in semiconductor lasers