As a long shot, if you have a Python version (or implement it yourself), running it with PyPy instead of Python might make things much faster, as it is well suited to code that uses Python built-ins and also many loops. It optimises these cases very well, through tricks such as garbage collection. The latest version also supports Python3.5 and 3.6 as well as NumPy.
From their website the main benefits:
Speed: thanks to its Just-in-Time compiler, Python programs often run
faster on PyPy. (What is a JIT compiler?)
“If you want your code to run faster, you should probably just use
PyPy.” — Guido van Rossum (creator of Python)
Memory usage: memory-hungry Python programs (several hundreds of MBs
or more) might end up taking less space than they do in CPython.
Compatibility: PyPy is highly compatible with existing python code. It
supports cffi and can run popular python libraries like twisted and
Stackless: PyPy comes by default with support for stackless mode,
providing micro-threads for massive concurrency.