Child struggling with toileting

My wonderful autistic 6yr old has a difficulty toileting and I can't seem to find anyone with info on his issue. He's toilet trained (no problem), not holding poo, and not constipated. His problem is he takes a very long time to toilet (poo specifically). I cant really work out why, he just says it takes a long time. Its causing problems, like at school today he didn't eat lunch because he was in the toilet for so long Disappointed. It's obviously very difficult too when we're out and it's public toilets.

We are under the peadeatrician at the moment but I'm looking to see if anyone has experienced similar and what the problem turned out to be, plus solution?

Any info gratefully received