I'm afraid that using Long class for all math isn't good. I think that better use Long only in
mul and
sqr functions. Then we can remove all unnecessary optimizations from Long class.
But fastest approach must forgive about Long class and use only JS-friendly math. I have working(and fast, more faster than latest version on github)
sign function, but can't solve problems with verify, so continue my work.
I have a few ideas about how to optimize the long class, but I need to spend time with a profiler first and see where all the time is being spent. Has anyone tried this already?