I finally have workers performing inference as quickly as on the main thread. This means workers now actually speed up the inference, with some substantial speed improvements as you move up to 4-8 cores. In fact, updating speed is no longer simply comparable to GeNIe, but can run quite a bit faster — OK, you should take that with a large grain of salt, because it’s BN-dependent, I’m not testing if the output variance is the same, and I’m just testing with the same number of sample iterations.
One nice side-effect of this is that I can finally unify the main-thread and worker-thread implementations. This may encourage me to clean the code organisation up a little bit. I hope.
2 workers are enabled by default for now. To change this number, go to the ‘Debug’ menu. It’s best to set the number equal to or slightly lower than the number of CPUs/cores that you have.
- Made worker-based belief update run as quickly as main thread update
- (The solution was to recreate BNs on the worker side, rather than pass in via structured clone. I’m unaware as to why this is needed, since the structures (TypedArrays, etc.) were identical as far as I could tell. This was the case on both Firefox and Chrome, so it’s obviously something I missed.)
- Enabled worker-based belief updating by default
- Added a ‘Debug’ menu
- (Mostly just performance-testing options.)
- Performance tweaks to continuous variables