Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster and simplified code to check for relevant movements #168

Merged
merged 1 commit into from
Aug 30, 2024
Merged

Conversation

suricactus
Copy link
Collaborator

Initial I thought I will only make

if source_names and "all" not in source_names:
    relevant_movements &= df.apply(lambda r: r["Sources"].getName() in source_names, axis=1)

Then I realized this is relatively heavy calculation and we can cache it, therefore I created the function _getMovementsIndicesBySourceNames.

Further optimize #167

Initial I thought I will only make

```
if source_names and "all" not in source_names:
    relevant_movements &= df.apply(lambda r: r["Sources"].getName() in source_names, axis=1)
```

Then I realized this is relatively heavy calculation and we can cache it,
therefore I created the function `_getMovementsIndicesBySourceNames`.
Copy link
Contributor

@luipir luipir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea :)

@luipir luipir merged commit 041f42a into main Aug 30, 2024
1 check passed
@luipir luipir deleted the cache branch August 30, 2024 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants