Given it’s a full on deep learning framework, it’s going to be quite heavyweight.
Are you sure it’s the library that is causing the slow down?
If so, is the profiler giving any clues on which part of the library is causing the worse of it?
Are there any parameters of brain.js that you can change to reduce the load per frame (such as prediction length?) The timeout property looks like it could be a good first step.
I was just copy pasting the raw code into my file, and then typing my neural networking code. I need a way to reference it in my files. Copy pasting makes it much slower. Also, there were no hints via the profiler, just Firefox saying that the page was slowing down the browser.