I haven't personally had a hip replacement - but a number of riding buddies have and so I can report, based on their experience, that the recovery is fairly fast (weeks not months) and the results can be absolutely excellent in terms of functionality post-surgery. One pal actually had both knees done and then the next year he had both hips done (he sort of the $600 man I guess) - and he told me that on a scale of 1-10, the knees were an 11 and the hips were a 4. He oughta know, I guess.
I do have personal experience with a knee replacement and I can confirm his ratings that a knee replacement is a whole different kettle of fish.
Despite what you might imagine, the total knee replacement surgery is much more intrusive, with a much higher risk of infection (this is an extremely serious concern BTW) and the post-op pain and recovery is much tougher than for a hip. The first week or so after a total knee-job is truly no-joke - so take the pain meds they give you because these will enable you to do the exercises that are absolutely vital to avoid winding up with a frozen knee or limited range of motion. Keeping the knee (or hip) moving in the first few days following surgery is crucial to your final recovery.
For either a hip or a knee, if you stick it out and do your exercises ALL THE TIME - you will recover quite quickly and well, even from a knee replacement. I had my knee replacement surgery on Jan. 19, 2019 and was able to drive a car about 5 weeks later and when the snow cleared here in SW Ontario in late March, I was back on my bikes (I wasn't kick-starting the olds ones, but I could certainly ride safely). I did my customary 2000km / 5-day tour with my riding buddies on my ST1300 in late-May-early June and had a great time. By the mid-spring, I could go up and down stairs without pain and my canes are all sitting idle in the closet now for the first time since I was injured in a fall in 1973 at the age of 15.
At this point, I feel great and walk 5km nearly every morning.
For both types of joint replacement, your recovery will depend nearly entirely on how diligently YOU do your prescribed exercises and physiotherapy. If you follow the physiotherapists instructions and work hard, you will recover quickly and well - and if you don't, you won't....and as with most things, you'd have only yourself to blame. Overall, if I needed another knee replacement, I would do it without hesitation. The best time IMO is early January as there is nothing else to do around here because of the weather, and it shouldn't affect the riding season at all.
My doctor told me that I could NOT overdo the exercises. The only thing he warned about was twisting my knee while it was bearing my weight - otherwise, go for it.
Pete