pokemon-showdown/test
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
..
application Fix chainbreeding validator 2018-02-01 21:06:37 -06:00
chat-plugins Trivia: fix crash in Trivia#destroy, pause when too many players absent (#3531) 2017-05-13 19:35:57 -05:00
simulator Cache species-specific effects (e.g. Arceus); 20% overall perf win (#4459) 2018-03-05 17:24:14 +09:00
.eslintrc
assert.js Refactor BattleEngine 2016-10-22 23:11:26 -05:00
common.js Refactor battle stream system 2018-01-28 21:06:49 -06:00
main.js Tests: Improve error message for Promise rejections 2018-01-31 21:53:10 -06:00
mocha.opts Remove validate-conditionals eslint rule 2018-01-19 13:25:10 -06:00