Skip to content

Cache table references #2080

Closed
Closed

Description

@jeromekelleher

Currently when we do things like tables.individuals.add_row we're running the following code:

   @property
    def individuals(self) -> IndividualTable:
        """
        The :ref:`sec_individual_table_definition` in this collection.
        """
        return IndividualTable(ll_table=self._ll_tables.individuals)

I think this was done originally to avoid some circular references, but it's totally unnecessary and actually a massive bottleneck. This is because every time we do a tables.individuals (e.g.) reference, we're actually parsing the metadata schema as well because we're creating a new table instance each time.

This is a good motivation for making sure that we do actually just create a single reference to the high-level table object at initialisation time, and to cache this as a private property (like we do in the Tree class for the quintuply linked arrays).

Activity

  1. added this to the milestone on Jan 5, 2022
  2. added
    Performance
    Python API
    on Jan 5, 2022
  3. removed this from the milestone on Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

PerformancePython API

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions