I have had limited experience of this, helping seniors with computing problems as a volunteer. One of my mentees had double-hip replacement. He definitely wasn't as sharp afterward. In his eighties.
My own cognitive state under anaesthetic, I am told was lucid but entertaining. I was interviewed by a doctor about some research project in wisdom teeth, post operative. It's 30 minutes of my life I have no recollection of, or even awareness. Another time after a colonoscopy I was told I was on a 30 second delay loop, replying well after the normal interval to any question. Slow.
It was the classic double of gastro and colon. Rather than a full general I may have been given what is called twilight. Beyond not having intubation, you still don't recall the procedure and afaik it's the same drugs and brain effects. Also if they do find polyps, and burn, or take biopsy I am told it's not exactly easy. They have to move you around. Asleep or dozing may be simpler. You're inflated.
I ask because I've done colonoscopy a few times (I have IBS plus family history of colon cancer) and not once did I get general anesthesia or anything that impacts my brain. It hurts a bit (mostly from the gaz they use to inflate the colon) and yes taking biopsy is a quick sharp pain but it's really not that bad.
Likewise for endoscopy (that's significantly more uncomfortable than colonoscopy though). At least in Europe and in Japan, general anesthesia is not part of the sop.
My own cognitive state under anaesthetic, I am told was lucid but entertaining. I was interviewed by a doctor about some research project in wisdom teeth, post operative. It's 30 minutes of my life I have no recollection of, or even awareness. Another time after a colonoscopy I was told I was on a 30 second delay loop, replying well after the normal interval to any question. Slow.