Ultrarapid spectroscopic gas detection via frequency-agile and compressed sensing