Skip to content

Memory leak in ts.variants() #2427

Closed
Closed

Description

@jeromekelleher

Benchmark:

import msprime
import time


before = time.perf_counter()
ts = msprime.sim_ancestry(
    10000,
    sequence_length=1000000,
    population_size=10_000,
    recombination_rate=1e-8,
    random_seed=1234,
)
ts = msprime.sim_mutations(ts, rate=1e-7, random_seed=1)
duration = time.perf_counter() - before
print(f"Simulation of {ts.num_trees} trees done after {duration:.2f} seconds")

for _ in range(10):
    for var in ts.variants():
        pass

Result:
vars-before

This is because the version of variants introduced in #2397 always looks at ts.tables.sites.position. This was released in 0.5.1.

Activity

  1. added
    bug
    Python API
    on Jul 21, 2022
  2. added this to the Python 0.5.2 milestone on Jul 21, 2022
  3. added 4 commits that reference this issue on Jul 21, 2022
    c106abe
    d655c44
    4e863d8
    01ef912
  4. added a commit that references this issue on Mar 22, 2024
    ada9596
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Python APIbug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions