You should be able to use the developer tools in the browser to pause the code periodically and look at the stack. This should give you an idea where the time is being taken. If the stack isn’t readable for the wasm code you could instead instrument the C++ code with some kinds of counters to track how often different methods are being called in response to events.
Thank you for sharing the code and your document. As you go forward with this project it would be helpful if you created a git repository to track the changes you make and so that others can more easily reproduce your configuration and help debug and/or contribute improvements.