brain
brain copied to clipboard
Unroll loops and data within toFunction()
This should be functionality equivalent to before, and the unit tests remain green. The resultant function should be much more friendly to the JITter, as it contains object accesses at the top, several pure math executions (which the JITter could theoretically parallelize), and an object create upon return. A greater-than 10x speedup was observed with the new method.
I'm curious what this looks like, as source, before and after. Do you have the performance numbers, and the project they ran on? Very interesting stuff!
Would you consider closing this here, and reopening at: https://github.com/harthur-org/brain.js/pulls?
If so, we could add you as a collaborator.