Thread:がか/@comment-27569068-20170320052009/@comment-26154973-20170324071539

Here is a graph. You almost never do this though. Let's call  external call, then you usually do few to ~10 external calls to Lua, all other stuff is internal, i.e., via , so, for example, for enemy patterns you do invoke 3 times (for easy, medium, and hard) and then require data from data modules up to 1000 times internally (for different enemies, maybe including duplicates, cached or not). Green dots are for proper templates that do it like that, e.g. (some arbitrary examples for existing pages)
 * Blue line is when you  Lua over and over for the same data module (unrealistic, can have over 3000 invokes).
 * Red line is when you  Lua for different data modules (maximum 200 in this test, then re-invoke for those 200 modules, it's dead at around 400-500 anyway).
 * A mix (same or different modules) is in the region in between.
 * Stuff like ship pages, equipment pages, etc., also drop lists and other small lists (like CV), one to few external and few to ~50 internal queries, < 5% for time and memory (using 3 seconds for 100%).
 * Big lists, one to few external queries, ~500 internal queries, ~10% time, still ~5% memory.
 * Can split it in ~20 external queries with 20-30 internal queries each, will be more time (like 1 second) and memory (~10%), but still ok, though it's always better to reduce the number of invokes.
 * Enemy patterns example is 2 seconds and 50/350 ~ 15% memory.