Skip to content

[enhancement] Synthetic population lazy imports#798

Open
maxbriel wants to merge 2 commits intov2.3from
mb_import_speedup
Open

[enhancement] Synthetic population lazy imports#798
maxbriel wants to merge 2 commits intov2.3from
mb_import_speedup

Conversation

@maxbriel
Copy link
Collaborator

@maxbriel maxbriel commented Feb 9, 2026

importing from the synthetic population file often took longer than a few seconds, when loading for the first time
i.e. from posydon.popsyn.synthetic_population import Population.

This is mostly due to the amount of other parts of the code that are loaded.

This brings the loading down from 1870ms to 737ms
Tested with python -X importtime -c "from posydon.popsyn.synthetic_population import Population"

The imports are still not great. Part of this seems to be how much we import from other parts of posydon.
For example, posydon.popsyn.synthetic_population imports popsyn.binarypopulation, and posydon.binary_evol.binarystar,etc, which is quite a large "time sink". See the attached image for the import time usage.

Focus on the top-left of the below images. These show what is taking the longest to import.

original import time:
importtime

importtime from this rework.
importtime

@maxbriel maxbriel self-assigned this Feb 9, 2026
@maxbriel maxbriel added the enhancement New feature or request label Feb 9, 2026
@maxbriel maxbriel requested a review from a team February 9, 2026 14:57
@maxbriel maxbriel changed the title Synthetic population lazy imports [enhancement] Synthetic population lazy imports Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments