Computing gx mod p is instant. Recovering x from the answer is the discrete logarithm problem, and it is one of the foundations of public-key cryptography. This tool solves it for small primes so you can see both the method and its limits.
Baby-step giant-step needs about √p steps and √p memory, so this tool caps p at 10,000,000. That limit is the whole point — real systems use primes with 600+ digits.
How baby-step giant-step works
Brute force tries every exponent in turn: up to p−1 attempts. Baby-step giant-step trades memory for time and finishes in roughly √p steps instead.
Write x = i·m + j where m = ⌈√(p−1)⌉. Build a table of gj for every small j — the baby steps. Then walk y backwards in strides of m — the giant steps — checking the table each time. A match gives both halves of x.
→ BSGS ≈ 1,000 steps
That is an enormous speed-up and still nowhere near enough. Square-rooting a 2048-bit number leaves a 1024-bit number — more operations than there are atoms in the observable universe. The gap between "much faster" and "feasible" is where key exchange lives.