Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module talk:Item

Discussion page of Module:Item

This page is also slow

Example page CE3K Eruption. As you can see, this template adds around 2 seconds to the page generation time. This is before I made any changes. I fed the module to chatgpt (since I didn't even know it was Lua until it told me) and it suggested changing a few things:

  1. Replace string concatenation with table.concat (reduces temp memory usage and object churn)
  2. Replace find() calls with exact-match checks, because we expect the object names to be exact (fix the template call if it isn't).

I'm going to run a limited test ONLY changing the code relevant to components and see what type of perf impact this has.

Before data

NewPP limit report
Cached time: 20240219162620
Cache expiry: 86400
Dynamic content: false
Complications: [vary‐revision‐sha1]
CPU time usage: 0.219 seconds
Real time usage: 4.002 seconds
Preprocessor visited node count: 1214/1000000
Post‐expand include size: 33944/2097152 bytes
Template argument size: 19299/2097152 bytes
Highest expansion depth: 18/40
Expensive parser function count: 0/100
Unstrip recursion depth: 0/20
Unstrip post‐expand size: 960/5000000 bytes

Transclusion expansion time report (%,ms,calls,template)
100.00% 3918.264      1 Template:Item
100.00% 3918.264      1 -total
 60.05% 2352.940      1 Template:Item/GenerateHeader
 22.72%  890.143      1 Template:Meta/MissingContentCheck
 22.64%  887.101      1 Template:Meta/MissingContentCheck/Private/Builder
 14.05%  550.401     23 Template:Nrow
 13.78%  540.110      2 Template:Tooltip
  0.19%    7.299      5 Template:Item/DropRow
  0.19%    7.267     11 Template:Item/NeededForRow
  0.18%    7.244      2 Template:Yesno-yes

After data #1

NewPP limit report
Cached time: 20240219163317
Cache expiry: 86400
Dynamic content: false
Complications: [vary‐revision‐sha1]
CPU time usage: 0.219 seconds
Real time usage: 4.016 seconds
Preprocessor visited node count: 1214/1000000
Post‐expand include size: 33944/2097152 bytes
Template argument size: 19299/2097152 bytes
Highest expansion depth: 18/40
Expensive parser function count: 0/100
Unstrip recursion depth: 0/20
Unstrip post‐expand size: 960/5000000 bytes

Transclusion expansion time report (%,ms,calls,template)
100.00% 3941.665      1 Template:Item
100.00% 3941.665      1 -total
 60.12% 2369.769      1 Template:Item/GenerateHeader
 22.58%  889.931      1 Template:Meta/MissingContentCheck
 22.50%  886.839      1 Template:Meta/MissingContentCheck/Private/Builder
 13.98%  551.131     23 Template:Nrow
 13.69%  539.567      2 Template:Tooltip
  0.24%    9.613      5 Template:Item/DropRow
  0.20%    7.759     11 Template:Item/NeededForRow
  0.16%    6.141      2 Template:Yesno-yes

hm...limited test is very slightly slower. Well, in for a penny, in for a pound. I'm going to keep going.

After data #2

In the revision history you'll see a couple more tries. One ended up breaking the sub-categories. It's just a bug with how I'm making obj.category a one-shot deal, but it also didn't make it any faster, so whatever it is about this module that slows the page down...maybe it isn't *this* module but something else. I don't know.

For testing, add &action=purge to the end of the URL to force the page to re-render and use your changed script.