I was interested in improving the performance of my test cases, so I decided to write a few profiling methods
so I can analyse what is taking the most time (the first fundamental rule of optimisation: know what to optimise
). The preliminary results (executed only on a single large test case of 9 test methods) are interesting:
13% of the time is spent inferring model elements;
54% of the time is spent executing code generation;
4% of the time is spent copying previously generated (cached) code generation files;
and 29% of the time is spent actually navigating the generated application.
However, these results are affected by the code generation cache. If I only consider the first test method (i.e. there is no way to reuse previously cached information), I get a more accurate representation of the necessary time for a single test case (which does very little web application navigation):
Here we can see the initial inference time and the initial code generation time - notice they are identical (in seconds) to the overall test time.
If we remove these constant costs, we can get a picture of the average cost per test case:
12% is spent loading from cache;
11% is spent waiting for AJAX calls to return; and
70% is spent navigating around the application otherwise.
More investigation is necessary to actually see which parts of my tests I need to focus optimisation on (by profiling the entire test suite, for example).