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

Avoid loading the entire log files into memory #105

Merged
merged 5 commits into from
Nov 17, 2022
Merged

Avoid loading the entire log files into memory #105

merged 5 commits into from
Nov 17, 2022

Conversation

ThibFrgsGmz
Copy link
Contributor

Originating Project/Creator
Affected Component
Affected Architectures(s)
Related Issue(s)
Has Unit Tests (y/n) n
Builds Without Errors (y/n) Let CI run
Unit Tests Pass (y/n) Let CI run
Documentation Included (y/n) n

Change Description

This PR aims to use the built-in file iterator rather than calling readlines() to read the log files.

PS: I've fixed some other small issues that I felt didn't deserve to be put in a dedicated PR.

Rationale

It is preferable to do it this way because the file object returned by Python when opening a file is a lazy iterator over the lines in that file.

This means that it is not necessary to use readlines() to loop through the file. Using built-in iteration is shorter and does not load the entire file into memory with a list object, as readlines() does, which can be more efficient.

Testing/Review Recommendations

Ref1
Ref2

Future Work

None

@LeStarch LeStarch merged commit 8ca56c1 into nasa:devel Nov 17, 2022
@ThibFrgsGmz ThibFrgsGmz deleted the feat/avoid-load-whole-file branch November 18, 2022 14:42
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