* add crude profiling to runDexSearch
No behavioral changes (other than console.log spam), this commit is just to establish a baseline and pinpoint the slow portions
* optimize datasearch.ts - pull move filter prep out of loop
Based on preliminary benchmarks, most of the time was spent getting the move validator, even for queries that don't specify a move.
More importantly, the parameters for fetching the move validator are known very early in the function and don't change during the loop.
Pulling that portion out of the loop is an easy win.
* improve profiling for runDexSearch
- add subcategories for filtering on move (the next optimization target)
- report unaccounted time amounts ('known unknowns')
- make grand total stand out more
* optimize dexsearch - fetch move list in outer loop
Move list depends on 'alts', which does not change in the loop over mons. Minor win, but simple.
* optimize dexsearch - filter move list by gen in outer loop
Neither 'mod' nor 'altMoves' changes during the inner loop.
* log pokemonSource in runDexSearch - expose possible leak
pokemonSources, which appears to act as a set, grows with each iteration, adding seemingly redundant items.
Will need to look closely at TeamValidator to identify the problem. My guess is that it's putting object references into a Set,
which, for objects other than strings, only cares about object identity.
* profile runDexSearch - count checkCanLearn calls
Also, semi-fix issue identified in prior commit - the endless growth of the restrictiveMoves list.
Counting the calls to checkCanLearn helps us reason about whether the cost per call is reasonable.
* fix perf bug in TeamValidator.checkCanLearn
use the cached ruleTable, save 100x.
* optimize runDexSearch - only init move filters when needed
For queries that never mention a move, a considerable chunk of time is wasted getting the objects needed for
'checkCanLearn'. I measure ~1ms savings for the relevant queries, which is often a decent percentage.
* profile dexsearch - delete and format
This is to document that they are not the bottlenecks.
* remove nested profiling from dexsearch
We've gotten to the point where we actually *are* measuring microseconds, so the frequent calls
are too expensive. This is a good problem to have! What we can see from running npm test is
that 'filters' and 'unaccounted' still account for a majority of the time. So, there's still
room for improvement, if that's ever a serious concern.
Personally, I think working on the moves API would be more fruitful.
* remove all profiling code
No more console.log or performance.now() calls. Ready to merge.
* Update server/chat-plugins/datasearch.ts
Format the 'format' string in-line.
Co-authored-by: Mia <49593536+mia-pi-git@users.noreply.github.com>
* Remove ts-expect-error from datasearch.ts
* Fix uninit lint in runDexSearch
---------
Co-authored-by: Mia <49593536+mia-pi-git@users.noreply.github.com>
* Auctions: Add Smogon export button for pricelist
* small formatting change
* fix formatting of help
* improve formatting of table at end of auction
yes I am hijacking this pr for other things
* call checkChat for /overpay
* Allow manually ended auctions to have the same end formatting
* Fix parsing negative credit amounts
* Remove font weight override on username list
* slightly decrease font size
* Refactor where Frostyicelad gets Fishious Rend
* Fix Froggeh's move
* Fix multiple teras, correct protocol message for shinies, other stuff
* Fix things i didnt test from the last commit and partman not displaying shiny
* Remove Goro Yagami
* Accurately depict Haste Inky's boost distribution
* simplify
Co-authored-by: urkerab <urkerab@users.noreply.github.com>
* fix
* Update data/mods/gen9ssb/moves.ts
* Fix Hogwash interaction with substitute
Also fix R8's move interaction with Substitute
* Add comment
* properly implement changing genders
* Rename Lily's move
'Recharge' as a move was already taken up by the must recharge forced move selection so this aims to revert that
* Fix bug with saintly bullet
* Update moves.ts
* Update conditions.ts
* Update moves.ts
* Update random-teams.ts
* Update pokedex.ts
* Wowee this is a LOT of balance changes
* Document Amnesia for phoopes
* all but archas to go
* dont explode pokemon immediately from end round + perish song
* Revert archas back to original pre nerf z move idea
* Nerf Xprienzo
* Add illusion checks
* Nerf Scovillain too.
* Improve Wonderer
* Tweak my quote a bit
* im bad
* Opple is now Apple
* apple wanted new quotes
* Finall add meme format
* display pestering assault in commands + add long desc for vruuuum
* Desc for nya innate
* Update Ultra Mystik desc
* Cake helped descriptions, also misc bugfixes and clarifications
* Don't hardcode custom mega abilities
* Update server/chat-plugins/randombattles/ssb.ts
* Update server/chat-plugins/randombattles/ssb.ts
* Update ssb.ts
---------
Co-authored-by: urkerab <urkerab@users.noreply.github.com>
Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com>
* Mafia: Stop removing players from the player table upon elimination.
* Mafia: Stop using RoomGame#playerTable
Unbeknownst to me when I wrote this plugin, playerTable is not a source of truth for who is in the game or not.
With this commit, I'm making it a policy for the mafia plugin to never directly read or mutate from the playerTable.
As an alternative, RoomGame#players is an array of players that can be accessed, and a Mafia#getPlayer(ID) method was added for ease of getting a specific player.
RoomGame#playerCount will no longer reflect the number of un-eliminated players as players in a Mafia game can be revived and are not removed from the game until it ends or they sub out.
Instead, we will not use the Mafia#getRemainingPlayers() method to get a array of remaining players and check its length for the uneliminated player count.