Carpeting came first before vacuum cleaners. The history of carpets can be traced back thousands of years, with evidence of carpet-making dating back to ancient civilizations like the Persians and the Egyptians. These early carpets were often made from natural fibers like wool and served both functional and decorative purposes.
On the other hand, vacuum cleaners are a relatively modern invention. The first powered vacuum cleaner was patented by Hubert Cecil Booth in 1901. His device was a large, horse-drawn, petrol-powered unit that blew air to create suction and removed dirt and dust from carpets by means of a system of pipes and filters. In 1908, James Murray Spangler, an American janitor, invented a portable electric vacuum cleaner using a fan, a pillowcase, and a broomstick. Spangler's design was the precursor to modern vacuum cleaners and was eventually sold to the Hoover Company.
So, carpeting has been around for thousands of years, while vacuum cleaners, as we know them today, were only developed in the early 20th century.