Skip to content

Serious performance degredation over time #735

@Serdra

Description

@Serdra

Over time, two players battling each other leads to serious performance degradation with no readily apparent cause (no memory leakage as far as I can tell). Here's the simplest code I found that reproduces the issue:

def minimum_repo():
    player1 = poke_env.RandomPlayer(max_concurrent_battles=1)
    player2 = poke_env.RandomPlayer(max_concurrent_battles=1)

    start_time = time.time()
    while (time.time() - start_time) < 5400:
        asyncio.run(player1.battle_against(player2, n_battles=250))
        player1.reset_battles()
        player2.reset_battles()
        print(f"Elapsed: {time.time() - start_time:.2f} seconds\n")

The elapsed time between iterations starts and remains constant for awhile before increasing dramatically, as shown here:

Image

Other things of note:

  • When decreasing the time and running the above python script several times in a row without restarting pokemon-showdown, there's no issue. This leads me to believe the issue is in poke-env, but I can't be sure of that.
  • This occurs no matter what I set n_battles to. If a single call to battle_against is used, with n_battles=9999999, the slowdown still eventually occurs. Same with n_battles=1
  • I've also tried with SimpleHeuristic and MaxDamage player, with the same result.

I'm running the most updated version of pokemon-showdown and poke-env, using the default config as mentioned in the setup documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions