I don’t understand your problem well enough to know, if you can (or want to) use this here, but you might be able to tap into that C performance with the radix conversion formatting of printf.
The problem is printing big binary to decimal. That’s not a easy problem because 10 is not a power 2. If we live in a base-hex world, this would be very easy to solve in O(n).
Also, I can’t access that as G’MIC is a language that can’t really communicate with other language as it’s not meant to share memory.
I’m just glad I have other options than just Python. Am not afraid of writing my solutions either. I rarely use Python these day.