This is a frequently asked question. Driving with no aids at all is best, at least in my opinion, because you are controlling the car completely and the computer has no say in what happens to it.
Turning off TCS - the car's engine will do exactly what you tell it to, so if you don't overdo the throttle and rip the drive wheels apart, you will be faster because the computer isn't taking any power away from the car.
But that's not what you asked about
ASM is a slightly less known effect, but basically what it tries to do is make your car more stable. 'Stable' is best defined as going in a straight line, so ASM usually blunts your turning capability. I don't know of anyone who has ASM turned on to make any car faster - in almost every situation involving a skilled driver, it will slow you down.
As I said, my recommendation for being a better driver is to turn all the aids off. I would say that the skill levels required is changed more by taking off the traction control than the stability devices, but the fewer aids you have on the more you are actually driving the car yourself, so you could say it requires more skill.
If you beat your friend without ASM when he has ASM on, there's two possible reasons:
1) You are a better driver, and therefore do not need the ASM to help you
2) Your friend is a better driver, but he is being slowed down by the ASM trying to stabilise the car
It's a pretty philosophical question, but I hope that helps 👍
DE