pokemon-showdown/test/simulator/misc
strager 423509bceb Cache species-specific effects (e.g. Arceus); 20% overall perf win (#4459)
Battle#getRelevantEffectsInner performs a lookup for the base species of
every Pokemon with ModdedDex#getEffect, then invokes callbacks. The
lookup is expensive, and callbacks very rare. In fact, there are only
ever two callbacks: one for Arceus (SwitchIn) and one for Silvally
(SwitchIn).

Instead of an expensive ModdedDex#getEffect lookup for the callbacks,
put the callbacks directly on the Pokemon's Template object.

On my machine, this commit speeds up Pokemon Showdown's tests by 20%.

Methodology: With and without this commit, I ran mocha four times with
zsh' 'time' builtin, dropped the first result, and averaged the wall
times:

    mocha times before this commit:
    18.20s user 0.33s system 118% cpu 15.704 total
    17.91s user 0.34s system 118% cpu 15.454 total
    18.11s user 0.33s system 118% cpu 15.558 total

    mocha times after this commit:
    15.58s user 0.33s system 122% cpu 13.028 total
    15.32s user 0.33s system 121% cpu 12.890 total
    15.56s user 0.32s system 121% cpu 13.068 total

    Hardware:
    Mid 2012 MacBook Pro
    2.6 GHz Intel Core i7

    Software:
    Node v9.0.0
    macOS 10.10.5
2018-03-05 17:24:14 +09:00
..
arceus.js Cache species-specific effects (e.g. Arceus); 20% overall perf win (#4459) 2018-03-05 17:24:14 +09:00
choice-parser.js Fix getChoice 2018-01-29 20:59:52 -06:00
decisions.js Fix getChoice 2018-01-29 20:59:52 -06:00
dex.js Refactor simulator into new sim/ directory 2017-05-05 16:48:38 -05:00
eventemitter.js Make eslint rules stricter 2017-10-08 04:41:11 -05:00
faint-order.js Test faint order 2017-12-01 13:06:01 -06:00
inversebattle.js Make Inverse Battle test work without a format 2017-12-01 23:11:31 +08:00
megaevolution.js Fix certain Abilities not being overwritten by most forme changes (#4245) 2017-12-14 11:45:12 -05:00
mixandmega.js Fix certain Abilities not being overwritten by most forme changes (#4245) 2017-12-14 11:45:12 -05:00
random-teams.js Tests: Fix typo 2018-03-02 14:32:28 +00:00
statuses.js Use PRNG in sim/ files (#4365) 2018-01-24 12:27:07 -06:00
statusmoves.js Rename Battle#on to Battle#onEvent 2017-05-05 16:48:38 -05:00
trapmoves.js Refactor old gens to for...of (#4274) 2017-12-23 21:46:04 -06:00
turn-order.js Implement Ultra Burst 2017-11-17 00:01:09 -06:00
typechange.js
weather.js Fix Hail/Sandstorm damage regression 2017-05-18 06:29:25 -05:00
weight.js Rename Battle#on to Battle#onEvent 2017-05-05 16:48:38 -05:00