ThioJoe / YT-Spammer-Purge

Allows you easily scan for and delete scam comments using several methods.
GNU General Public License v3.0
4.57k stars 389 forks source link

optimize for loop in operations.py #1097

Closed virophagesp closed 6 months ago

virophagesp commented 7 months ago

the order of the list it is iterating over does not matter

Why is this change needed: it reduces latency for reply scanning

Additional Info: the for loop doesnt require a proper order

Checklist:

virophagesp commented 6 months ago

how do i check the boxes

virophagesp commented 6 months ago

nevermind i figured it out

virophagesp commented 6 months ago

@ThioJoe this is ready to be checked

ThioJoe commented 6 months ago

Isn't this made redundant by line 744?

virophagesp commented 6 months ago

not exactly, line 744 prevents it going through if it never had the @ symbol in the first place line 749 modifies the original commentText variable allThreadAuthorNames can be very long usually there is only a single @ username when commentText gets modified to no longer have any @'s my code breaks out of the loop

virophagesp commented 6 months ago

I am going to benchmark the code and find how much of an improvement it is

virophagesp commented 6 months ago

so turns out it is less than 0.05% in most cases I did the original benchmark wrong I'm gonna close this now