For this reason, currently people are finding most success with WebAssembly for algorithmic / compute-intensive tasks.
i realized that I didnt know how to manipuate the dom in c++. Is there any way to do this using wasm?
As this is quite a common challenge, there are various community project that have solutions to the problem. As you are using C++, this one might be of interest to you:
In the future, this will get easier, proposals such as Interface Types are making it easier to interop with the host environment and could allow Web APIs to be called directly from WebAssembly.