Closed charlesbaynham closed 3 years ago
That would be the problem behind #111
Logs for the above test. These show 312 commits to the database and 571 selects, just for joining and rendering states for 10 players. That's 57 database queries per render, and 31 writes. eeek!
N.B. setting debug level back to INFO and removing sqlalchemy logging, I still get 2.656 per state, so barely any difference.
In 50c28f8, test_state_speed
reports for 5x players in a game (n.b. previous stats were for 10x)
WARNING root:test_backend.py:82 time_per_join = 0.754s of which 0.548s in 17.6 DB calls
WARNING root:test_backend.py:85 time_per_render = 1.446s of which 1.020s in 29.0 DB calls
Not finished, but this is an improvement. On version fb169e1 I'm down to
WARNING root:test_backend.py:82 time_per_join = 0.923s of which 0.817s in 12.0 DB calls
WARNING root:test_backend.py:85 time_per_render = 0.915s of which 0.685s in 22.0 DB calls
Merging into master for now, but I should continue later.
After lots of faffing around in #119, I'm back to speed profiling.
With code at fd783d8a09e00aa72f822d9e68bbb9ff4e3336ed, I can run
to profile the speed of state rendering and can alter
.env
toTo run my local tests against a real PostgreSQL database.
Doing so, I get 2700ms per state, compared to 150ms per state with a local SQLite database.