What you have done for optimisation?
"premature optimization is the root of all evil" - Donald Knuth. So nothing really. I'll post the github in the description, if you want to check it out, and can understand gdscript.
There's nothing that really needed to be optimised anyway. The algorithm is really fast.