Thursday, May 14, 2020

timing page rendering with and without Sympy

I noticed that page rendering for derivationmap.net is slow and wanted to time the rendering to see what timing "slow" actually meant.

To summarize the results below, the first load of SUVAT with Sympy turned on took almost 30 seconds. In constrast, with Sympy turned off, the second load of the same derivation took 8 seconds.
--> That's a big difference in user experience.
30 seconds is also the threshold where Nginx times out waiting for the backend, so getting the time lower is important (or else the page won't show up).

The more meaningful comparison is second load of SUVAT with and without Sympy. That change is 15 seconds to 8 seconds, a factor of 2x improvement.
The same 2x improvement also occurs for the other derivation (6.4 to 3.2 seconds).
--> That indicates there is value in caching Sympy validation results (though we probably won't recover the full 2x).

The second takeaway is that 8 seconds for a page to load with Sympy is turned off is still too long.
The flask logs are not configured to enable profiling -- they merely indicate when an event started. Because I don't long when an event finished, I cannot create a flame graph.

derivation which render render time in seconds with d3js with graphviz PNG with Sympy inf rule check
SUVAT 1 19.6 Yes Yes No
SUVAT 2 7.8 Yes Yes No
SUVAT 3 7.4 Yes Yes No
SUVAT 1 28.4 Yes Yes Yes
SUVAT 2 15.2 Yes Yes Yes
SUVAT 3 14.8 Yes Yes Yes
Maxwell Eq 1 7.4 Yes Yes No
Maxwell Eq 2 3.2 Yes Yes No
Maxwell Eq 3 3.2 Yes Yes No
Maxwell Eq 1 13.6 Yes Yes Yes
Maxwell Eq 2 6.4 Yes Yes Yes
Maxwell Eq 3 6.7 Yes Yes Yes

No comments:

Post a Comment