My BS took 4 years. My MS took 2 years. My PhD (computational physics) took 7 years.
I was the fast one at my school. Some of my peers (high energy physics, nuclear, etc.) took 9+ years.
Then again, I met my former business partner (not at the time) while in grad school. I was 2 years into my research, and he was a fresh new assistant prof in CS. About 9 weeks younger than me. Ph.D. in CS in 3.5 years.
In the UK and Europe, shorter PhDs are much more common, in part because you're expected to do a master's before a PhD.
Even for two or three years, I don't think getting a computer science PhD is a good bet if your primary goal is making more money.
I tell students to expect 5-6 depending on whether you want to go to industry or academia.
That’s true of Europe but it’s quite common to go straight from a Bschelor’s to a doctorate in the U.K. and many other former British Empire countries.
When I finished up in the 90s, the market was flooded with applicants from the former soviet union as well as locals. I remember speaking to people I knew on hiring committees who told me of 1000+ applicants per open tenure track position at tier 2 and tier 3 schools.
Around that time I was looking at the postdoc train, saw where it (didn't quite) led, and chose a different path.
The discrepancy here may be that "PhD time" in the US usually includes a masters, while it is counted separately elsewhere. That said, even if you break it down, my MS took 2 years and the PhD took another 5.
Between classes, teaching, and genuinely getting things done, it's not a fast experience.
Also, you probably arent making a ton more unless you go for an industry job...which is a little bit the opposite of the Platonic independence supposedly at the heart of the training method.
But very few people I know want to be a PI.
I took eight years but I also got married, worked full time, and started a company before I finished. By the time I graduated, the CS department had started taking a much firmer stance on timelines, with a desire for most students to graduate within six years or sooner.