feagi / brain-visualizer

Apache License 2.0
0 stars 1 forks source link

Establish a performance benchmark for BV #319

Open m-nadji-tehrani opened 1 month ago

m-nadji-tehrani commented 1 month ago

To help assess the current bottlenecks and priorotize improvements, we need to perform the following performance benchmarks in browser against ( 1. Chrome, 2. Edge, 3. Safari, 4, Firefox)

Important note: Perform all the measurements without having FEAGI in the mix

For each of the following instances, we need to measure the following before and after:

  1. Memory usage
  2. CPU usage
  3. Network usage
  4. UI interaction experience ( Interaction with UI such as dragging, zooming, moving, etc. should not be sluggish )

Each measure meant should accompany the following system information:

Measurement scenarios:

  1. 3D monitor performance with cortical area count as variable (1, 10, 100, 500) with no neuron activity
  2. CB performance with cortical area count as variable (1, 10, 100, 500) with no neuron activity
  3. 3D monitor performance with neuron firing as a variable (1, 100, 1000, 10000, 50000, 100000) with no cortical area
  4. CB performance with 1 cortical area mapped to (1, 10, 100) other cortical areas
Amir-Rasteg commented 1 month ago

stats:

Machine specs: Windows 10 AMD Ryzen 3900x, 32 GB ram, RTX 3080

All done at feagi tick rate of 40 hz, from desktop app (browser - firefox). Test controlled by running the FEAGI Bridge in stress test mode.

Websocket Off-> 0.0 ms : FPS ~140 Websocket On power only -> ~ .02 ms - 0.10 ms : FPS ~140 Websocket 100 neuron noise -> ~ 0.6 ms websocket parsing, 0.12 ms test : FPS ~130 Websocket 500 neuron noise -> ~ 1.3 ms websocket parsing, 0.5 ms test parsing ms : FPS ~130 Websocket 1000 neuron noise -> ~ 2.2 ms websocket parsing, 1.0 ms test parsing ms : FPS ~130 Websocket 10000 neuron noise -> ~20 ms websocket parsing, 10.2 ms test parsing ms : FPS ~90 : Web FPS: ~30 Websocket 20000 neuron noise -> ~38.5 ms websocket parsing, 20.6 ms test parsing ms : FPS ~55 : Web FPS: ~10 Websocket 30000 neuron noise -> ~56.5 ms websocket parsing, 30.6 ms test parsing ms : FPS ~40 : Web FPS: no

Note: FPS numbers are misleading, since FPS alternatives between median being high to extremely slow lows, leading to the experience being stuttery

Ultimately, a vast majority of the performance penalty (over 99% at higher neuron counts) came from Websocket parsing and how BM renders the information. Clearly this is our target for optimization

Amir-Rasteg commented 1 month ago

the solution to these performance issues are to be discussed in https://github.com/feagi/brain-visualizer/issues/326

Amir-Rasteg commented 1 month ago

Kevin made a test for having the array be flat. Did some quick performance metrics using the new code (all other variables the same)

Websocket 100 neuron noise -> ~ 0.64 ms websocket parsing, 0.16 ms generate_red_voxel Websocket 500 neuron noise -> ~ 1.23 ms websocket parsing, 0.69 ms generate_red_voxel Websocket 30000 neuron noise -> ~ 51.42 ms websocket parsing, 38.36 ms generate_red_voxel

Performance wise overall this appears to be doing worse (or at least not better, run time variance is a factor).