User:Tiddlywinks/Recycle Bin/MoveHeadSubs

From Bulbapedia, the community-driven Pokémon encyclopedia.
Jump to navigationJump to search
User:Tiddlywinks/MoveHeadSubs/1User:Tiddlywinks/MoveHeadSubs/1User:Tiddlywinks/MoveHeadSubs/1User:Tiddlywinks/MoveHeadSubs/1User:Tiddlywinks/MoveHeadSubs/1User:Tiddlywinks/MoveHeadSubs/1User:Tiddlywinks/MoveHeadSubs/1User:Tiddlywinks/MoveHeadSubs/1User:Tiddlywinks/MoveHeadSubs/1
# Pokémon Types Egg Groups Level
...
...
...
...
...
...
...



Template documentation
Note: portions of the template sample may not be visible without values provided.
View or edit this documentation. (About template documentation)

... learn tables for move pages, sticky headers ...

This is a subtemplate approach that forgoes one of the parser cases (at the tradeoff of include size...which may not be terrible considering everything the all-in-one approach needs to include). Arguably it's a little simpler. Will be comparing with Template:Movehead/TMGames.

Conclusion: I went with Template:Movehead/TMGames because #Comparisons seem to show that performing better, and move pages can be large. I'm not sure if this will be of any use otherwise, but I'll keep it here for the record (comparisons) for the time being.

Parameters

  • 1: color
  • 2: header label
  • 3 (optional): colspan (defaults to 100, seems fine in Firefox, idk if it screws with anything else)
  • [g#]: number of games in this generation, "none" to hide the generation
  • [g#g], [g#g-#]: text for the game line of each generation('s first, second, etc game)
  • [g#tm], [g#tm-#]: the TM number for each generation('s first, second, etc game)

(If a need for custom tutor links arises, we can add some parameters that default to the current pass-through values, but for now, we'll keep it a little simple.)

Currently, g5, g7, and g8 have multiple games explicitly coded with useful default values. You should mostly be able to use any value (1-3) for g# and set g#g-# to show any desired combination of games, but there is currently no custom tutor link parameter, so tutors would not link to any subsection of the Move Tutor page (or perhaps even a wrong one).

Examples

{{User:Tiddlywinks/MoveHeadSubs|Dark|TM/Tutor|g1tm=23
|g2g={{gameabbrev2|C}}|g2tm=24
|g3tm=25
|g4tm=26
|g5tm=27
|g6tm=28
|g7=2|g7tm-1=29|g7tm-2=30
|g8=3|g8tm-1=31|g8tm-2=32|g8tm-3=33
|g9tm=34
}}
{{Moveentry/12|0004|Charmander|type=Fire|2|Monster|Dragon|?|II|III|IV|V|VI|VII|PE|VIII|BDSP|━|IX|STAB='''}}
{{Moveentry/12|0005|Charmeleon|type=Fire|2|Monster|Dragon|?|II|III|IV|V|VI|VII|PE|VIII|BDSP|━|IX|STAB='''}}
{{Moveentry/12|0006|Charizard|type=Fire|type2=Flying|2|Monster|Dragon|?|II|III|IV|V|VI|VII|PE|VIII|BDSP|━|IX|STAB='''}}
{{Moveentry/12|0031|Nidoqueen|type=Poison|type2=Ground|1|No Eggs Discovered|No Eggs Discovered|?|II|III|IV|V|VI|VII|PE|VIII|BDSP|LA|━}}
|}

User:Tiddlywinks/MoveHeadSubs |- style="background:#fff" | style="font-family:monospace,monospace" width="26px" | 0004 | style="text-align:center;" width="26px" | Charmander

| width="75px" |

| style="text-align:center; | FireIC Big.png | style="text-align:center; background:#D25064;" width="70px" | Monster | style="text-align:center; width:70px; background:#7A42FF;" | Dragon ! ? ! II ! III ! IV ! V ! VI ! VII ! PE ! VIII ! BDSP ! ━ ! IX |- style="background:#fff" | style="font-family:monospace,monospace" width="26px" | 0005 | style="text-align:center;" width="26px" | Charmeleon

| width="75px" |

| style="text-align:center; | FireIC Big.png | style="text-align:center; background:#D25064;" width="70px" | Monster | style="text-align:center; width:70px; background:#7A42FF;" | Dragon ! ? ! II ! III ! IV ! V ! VI ! VII ! PE ! VIII ! BDSP ! ━ ! IX |- style="background:#fff" | style="font-family:monospace,monospace" width="26px" | 0006 | style="text-align:center;" width="26px" | Charizard

| width="75px" |

| style="text-align:center; | FireIC Big.png
FlyingIC Big.png | style="text-align:center; background:#D25064;" width="70px" | Monster | style="text-align:center; width:70px; background:#7A42FF;" | Dragon ! ? ! II ! III ! IV ! V ! VI ! VII ! PE ! VIII ! BDSP ! ━ ! IX |- style="background:#fff" | style="font-family:monospace,monospace" width="26px" | 0031 | style="text-align:center;" width="26px" | Nidoqueen

| width="75px" |

| style="text-align:center; | PoisonIC Big.png
GroundIC Big.png | style="text-align:center; background:#333333;" width="140px" colspan="2" | No Eggs Discovered | style="text-align:center; display:none; background:#333333;" | No Eggs Discovered ! ? ! II ! III ! IV ! V ! VI ! VII ! PE ! VIII ! BDSP ! LA ! ━ |}


{{User:Tiddlywinks/MoveHeadSubs|Dark|TM/Tutor|g1tm=23
|g2tm=24
|g3tm=25
|g4tm=26
|g5tm=27
|g6tm=28
|g7tm=29
|g8tm=31
|g9tm=34
}}
{{Moveentry/9|0004|Charmander|type=Fire|2|Monster|Dragon|?|II|III|IV|V|VI|VII|VIII|IX|STAB='''}}
{{Moveentry/9|0005|Charmeleon|type=Fire|2|Monster|Dragon|?|II|III|IV|V|VI|VII|VIII|IX|STAB='''}}
{{Moveentry/9|0006|Charizard|type=Fire|type2=Flying|2|Monster|Dragon|?|II|III|IV|V|VI|VII|VIII|IX|STAB='''}}
{{Moveentry/9|0031|Nidoqueen|type=Poison|type2=Ground|1|No Eggs Discovered|No Eggs Discovered|?|II|III|IV|V|VI|VII|VIII|━}}
|}

User:Tiddlywinks/MoveHeadSubs |- style="background:#fff" | style="font-family:monospace,monospace" width="26px" | 0004 | style="text-align:center;" width="26px" | Charmander

| width="75px" |

| style="text-align:center; | FireIC Big.png | style="text-align:center; background:#D25064;" width="70px" | Monster | style="text-align:center; width:70px; background:#7A42FF;" | Dragon ! ? ! II ! III ! IV ! V ! VI ! VII ! VIII ! IX |- style="background:#fff" | style="font-family:monospace,monospace" width="26px" | 0005 | style="text-align:center;" width="26px" | Charmeleon

| width="75px" |

| style="text-align:center; | FireIC Big.png | style="text-align:center; background:#D25064;" width="70px" | Monster | style="text-align:center; width:70px; background:#7A42FF;" | Dragon ! ? ! II ! III ! IV ! V ! VI ! VII ! VIII ! IX |- style="background:#fff" | style="font-family:monospace,monospace" width="26px" | 0006 | style="text-align:center;" width="26px" | Charizard

| width="75px" |

| style="text-align:center; | FireIC Big.png
FlyingIC Big.png | style="text-align:center; background:#D25064;" width="70px" | Monster | style="text-align:center; width:70px; background:#7A42FF;" | Dragon ! ? ! II ! III ! IV ! V ! VI ! VII ! VIII ! IX |- style="background:#fff" | style="font-family:monospace,monospace" width="26px" | 0031 | style="text-align:center;" width="26px" | Nidoqueen

| width="75px" |

| style="text-align:center; | PoisonIC Big.png
GroundIC Big.png | style="text-align:center; background:#333333;" width="140px" colspan="2" | No Eggs Discovered | style="text-align:center; display:none; background:#333333;" | No Eggs Discovered ! ? ! II ! III ! IV ! V ! VI ! VII ! VIII ! ━ |}

Notes

TBD:

  • it'd be nice if, in a mix of "game+tm" and "tm only" columns, "tm only" was aligned to the bottom, but I don't know how to make that work (text-align: bottom doesn't do it (and using br instead of divs invites extra problems), and I can't get flex stylings to behave well)
  • probably just create a second template that doesn't use TMs at all
  • Once we're sure Gen 1-6 won't be splitting any further, we can eliminate a few unnecessary parameters being passed. Most could have at least two (g3/4 could have three). The latest should always have as much as the largest generation, just in case (it can be trimmed at the same time as the next generation is added, when we know there's no more).

Parsers in this template currently...

  • #ifeq: 9 directly, 1-3 in subtemplates (which will be called 0-9 times depending on the values used for each g# parameter)
    • not all can be hit simulatenously because of "branching", there's 1 for hiding each generation header (9), and 1 for checking for "tutor" for each game (1-3 per generation/column displayed)
      • at minimum, 9 will be hit,
      • at maximum, 36 will be hit (if you set all g#=3)
        • if you mimic Movehead/TMGames's maximum columns (g1=1, g2=1, g3=1, g4=1, g5=2, g6=1, g7=2, g8=3, g9=1), max is 22

(And no #switches.)

Comparisons

I'll list some comparisons here of the parser profiling data shown when previewing a page that uses Template:Movehead/TMGames vs User:Tiddlywinks/MoveHeadSubs. The parameters to call each are exactly the same, all that needs to change is the name, meaning All just uses 1 less character to call it than Subs. (Note that edits to these templates since I gathered these numbers could affect some of the stats if you test it again.)

...While we're at it, I'll throw User:Tiddlywinks/MoveHead (a piecemeal builder) into the mix for the first case too.

Using most games
{{Movehead/TMGames|Dark|TM/Tutor
|g1tm=23
|g2g={{gameabbrev2|C}}|g2tm=24
|g3tm=25
|g4tm=26
|g5tm=27
|g6tm=28
|g7=2|g7tm-1=29|g7tm-2=30
|g8=3|g8tm-1=31|g8tm-2=32|g8tm-3=33
|g9tm=34
}}
|}

Piecemeal:
{{User:Tiddlywinks/MoveHead|Dark|12|TM/Tutor}}
|-
{{User:Tiddlywinks/MoveHead/game|I|Kanto| |[[TM24]]}}
{{User:Tiddlywinks/MoveHead/game|II|Johto|{{gameabbrev2|C}}|[[Move Tutor#Crystal|Tutor]]}}
{{User:Tiddlywinks/MoveHead/game|III|Hoenn| |[[TM24]]}}
{{User:Tiddlywinks/MoveHead/game|IV|Sinnoh| |[[TM24]]}}
{{User:Tiddlywinks/MoveHead/game|V|Unova| |[[TM24]]}}
{{User:Tiddlywinks/MoveHead/game|VI|Kalos| |[[TM24]]}}
{{User:Tiddlywinks/MoveHead/game|VII|Alola|{{gameabbrev7|SMUSUM}}|[[TM24]]}}
{{User:Tiddlywinks/MoveHead/game|VII|Alola|{{gameabbrev7|PE}}|[[TM24]]}}
{{User:Tiddlywinks/MoveHead/game|VIII|Galar|{{gameabbrev8|SwSh}}|[[TM24]]}}
{{User:Tiddlywinks/MoveHead/game|VIII|Galar|{{gameabbrev8|BDSP}}|[[TM24]]}}
{{User:Tiddlywinks/MoveHead/game|VIII|Galar|{{gameabbrev8|LA}}|[[Move Tutor#Crystal|Tutor]]}}
{{User:Tiddlywinks/MoveHead/game|IX|Paldea| |[[TM24]]}}
|}

Here, subs is a little worse than all, except in argument size where it's much higher. The piecemeal approach seems better in most stats, but it's even worse than subs argument-wise (which doesn't feel right, but...??).

Stat All Subs Piecemeal
CPU time usage 0.042 seconds 0.052 seconds 0.043 seconds
Real time usage 0.214 seconds 0.229 seconds 0.144 seconds
Preprocessor visited node count 483/1,000,000 638/1,000,000 424/1,000,000
Post-expand include size 9,067/2,097,152 bytes 9,059/2,097,152 bytes 8,355/2,097,152 bytes
Template argument size 376/2,097,152 bytes 1,180/2,097,152 bytes 1,233/2,097,152 bytes
Highest expansion depth 9/40 10/40 8/40
Expensive parser function count 0/100 = =
Unstrip recursion depth 0/20 = =
Unstrip post-expand size 0/5,000,000 bytes =
Starting from gen 3
{{Movehead/TMGames|Dark|TM/Tutor
|g1=none
|g2=none
|g3tm=25
|g4tm=26
|g5tm=27
|g6tm=28
|g7=2|g7tm-1=29|g7tm-2=30
|g8=3|g8tm-1=31|g8tm-2=32|g8tm-3=33
|g9tm=34
}}
|}

Here, subs closes the distance a little in the non-time stats (and time could just be random variance).

Stat All Subs
CPU time usage 0.039 seconds 0.041 seconds
Real time usage 0.198 seconds 0.137 seconds
Preprocessor visited node count 427/1,000,000 566/1,000,000
Post-expand include size 7,908/2,097,152 bytes 7,892/2,097,152 bytes
Template argument size 267/2,097,152 bytes 984/2,097,152 bytes
Highest expansion depth 8/40 9/40
Expensive parser function count 0/100 =
Unstrip recursion depth 0/20 =
Unstrip post-expand size 0/5,000,000 bytes =

For simplicity, I'll just state the outcome of starting at gen 8: like above, subs closes the distance a bit in the non-time stats, but its time seems to be worse. Gen 9 only gets pretty close to even, except for preprocessor visited node count (not sure what that means).

Summary

In short, I guess the subtemplates didn't save as much trouble as I thought they might. (Especially since a couple cool things in my initial theorizing didn't pan out through the implementation.) But they are arguably simpler to read and update, which isn't nothing. On the other hand, "all" is much easier to read when you remove the TM/tutor part, so for the non-TM/tutor tables, that version should be fine (but I don't know if that might mean mixing them or sticking with "all").

Really, it's basically a question of how much of a pain updating the template is. And, fundamentally...that could be solved with thorough update instructions. (Figuring out...or adding parameters can also be an issue. But the former part is also obviated by good documentation.)

Updating

...