A distance measuring device based on a time-of-flight of an optical pulse, comprising a transmitter, a transmitter controller and a receiver; the transmitter comprises a semiconductor laser, for which the ratio of a thickness d of the active layer to an active layer optical confinement factor Γ a is larger than 2.5μm, is configured to output optical pulses (110, 110') of controllably variable temporal widths, the semiconductor laser being configured to operate in an enhanced gain switching regime for generating an optical pulse of a minimum generable temporal width of the laser, and in a quasi steady state different from the enhanced gain switching regime for generating a longer optical pulse (110', 110) than that of the enhanced gain switching regime; the transmitter controller is configured to control a duration of the optical pulses as a function of an estimated distance to be measured such that the transmitter controller is configured to adjust amplitude and/or a temporal width of an electric pulse input to the laser for controlling a temporal width of the optical pulses (110', 110); the receiver comprises a matrix of single photon avalanche detector elements (310 to 326) of a Geiger mode, a receiver controller, and time-to-digital converters; the single photon avalanche detector elements (310 to 326) of the matrix are configured to detect optical pulses sent by the transmitter and reflected from a target to the matrix, and each of the single photon avalanche detector element (310 to 326) is configured to output an electric signal in response to each detection; a number of the time-to-digital converters is smaller than a number of the single photon avalanche detector elements (310 to 326) of the matrix; the receiver controller is configured to connect at least two of the single photon avalanche detector elements (310 to 326) with different time-to-digital converters; and the time-to-digital converters connected with the single photon avalanche detector elements (310 to 326) are configured to provide timings of the detected optical pulses on the basis of each output electrical signal for determination of information associated with a distance of the target on the basis of each timing. the transmitter comprises a semiconductor laser, for which the ratio of a thickness d of the active layer to an active layer optical confinement factor Γ a is larger than 2.5μm, is configured to output optical pulses (110, 110') of controllably variable temporal widths, the semiconductor laser being configured to operate in an enhanced gain switching regime for generating an optical pulse of a minimum generable temporal width of the laser, and in a quasi steady state different from the enhanced gain switching regime for generating a longer optical pulse (110', 110) than that of the enhanced gain switching regime; the transmitter controller is configured to control a duration of the optical pulses as a function of an estimated distance to be measured such that the transmitter controller is configured to adjust amplitude and/or a temporal width of an electric pulse input to the laser for controlling a temporal width of the optical pulses (110', 110); the receiver comprises a matrix of single photon avalanche detector elements (310 to 326) of a Geiger mode, a receiver controller, and time-to-digital converters; the single photon avalanche detector elements (310 to 326) of the matrix are configured to detect optical pulses sent by the transmitter and reflected from a target to the matrix, and each of the single photon avalanche detector element (310 to 326) is configured to output an electric signal in response to each detection; a number of the time-to-digital converters is smaller than a number of the single photon avalanche detector elements (310 to 326) of the matrix; the receiver controller is configured to connect at least two of the single photon avalanche detector elements (310 to 326) with different time-to-digital converters; and the time-to-digital converters connected with the single photon avalanche detector elements (310 to 326) are configured to provide timings of the detected optical pulses on the basis of each output electrical signal for determination of information associated with a distance of the target on the basis of each timing.