The performance of an ultrafast all-optical logic gate based on quantum-dot semiconductor optical amplifier (QD-SOA) has been theoretically analyzed in this paper. We introduce a novel approach to accelerate the gain recovery process with a control pulse (CP) using the cross-gain modulation (XGM) effect. It is shown that the optical XOR gate in a Mach-Zehnder interferometer-based structure is feasible at Tb/s speeds with proper quality factor. The operation capability at 2.5 Tb/s with a Q-factor of 4.9 and 2 Tb/s with a Q -factor of 8.8 is reported for the first time. This capability indicates great potential for ultrafast all-optical signal processing and switching.