Wikipedia has a small article on finding the nth root of reals and another article on a more efficient implementation, both obviously adaptable to floats. And of course, efficient integer square root algorithms also exist - there's multiple questions on this site just about efficient implementations for that.
But all those deal with reals, and all I'm concerned about here are integers. I did find an existing question on the topic where this may seem almost a duplicate of, but where that's asking about if an efficient algorithm exists, I'm looking for what the most efficient algorithm is.
For context, this would only be used with 32-bit two's complement integers (specifically coerced signed JS integers) and it would be as part of a generic signed integer exponentiation algorithm int iexp(int base, int exp)
, handling the case of negative exponents. Bit hacks and other two's complement hacks are fair game here - I don't care and I do understand them to some extent. (It's for a standard library implementation for a language I'm working on, so I'd rather this not be slow.)
And language doesn't matter - I can translate whatever, whether it's C, JS, Python, or even OCaml.