1. An optical apparatus for performing inspection or metrology of a semiconductor device, comprising: a plurality of laser diode arrays that are configurable to provide an incident beam having different wavelength ranges; optics for directing the incident beam towards the sample; a detector for generating an output signal or image based on an output beam emanating from the sample in response to the incident beam; optics for directing the output beam towards the detector; and a controller for configuring the laser diode arrays to provide the incident beam at the different wavelength ranges and detecting defects or characterizing a feature of the sample based on the output signal or image.