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

Potentially unneeded memory alloc in StopwordCount #186

Open
sbadithe opened this issue Jul 30, 2022 · 0 comments
Open

Potentially unneeded memory alloc in StopwordCount #186

sbadithe opened this issue Jul 30, 2022 · 0 comments

Comments

@sbadithe
Copy link
Contributor

I don't think we need to create a list in this comprehension:

count = len([word for word in words if word.lower() in swords])

Instead, I think we can just iterate over words and keep a count variable. For very large strings this would save the time and memory needed to alloc the list.

@sbadithe sbadithe changed the title Potential unneeded memory alloc Potential unneeded memory alloc in StopwordCount Jul 30, 2022
@exalate-issue-sync exalate-issue-sync bot changed the title Potential unneeded memory alloc in StopwordCount Potentially unneeded memory alloc in StopwordCount Mar 15, 2023
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

No branches or pull requests

1 participant