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

Improved performance of URL modification generation function #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GuilhermeMonteiroPeixoto
Copy link

@GuilhermeMonteiroPeixoto GuilhermeMonteiroPeixoto commented Jan 4, 2023

To improve the performance of this function, one way would be to change the inner loop that iterates over alteration_words to create the URLs to an outer loop. This way, instead of iterating over alteration_words on each iteration of the main loop, you could iterate over alteration_words just once and generate all the URLs at once. This should be faster than doing it on each iteration of the main loop.

Another suggestion would be to change the main loop to iterate over a list of tuples, where each tuple is formed by the current subdomain and the alteration_words to be added to it. This way, you could generate all the URLs with the modified subdomains at once, instead of having to read and write each line individually to the output file.

Uma maneira de melhorar a performance dessa função seria mudar o loop interno que itera sobre alteration_words para criar as URLs para um loop externo. Dessa forma, ao invés de iterar sobre alteration_words a cada iteração do loop principal, você poderia iterar sobre alteration_words apenas uma vez e gerar todas as URLs de uma vez. Isso deve ser mais rápido do que fazer isso a cada iteração do loop principal.

Outra sugestão seria mudar o loop principal para iterar sobre uma lista de tuplas, onde cada tupla é formada pelo subdomínio atual e os alteration_words a serem adicionados nele. Dessa forma, você poderia gerar todas as URLs com os subdomínios modificados de uma vez, em vez de ter que ler e escrever cada linha individualmente no arquivo de saída.

Além disso, você poderia considerar usar os módulos concurrent.futures ou multiprocessing do Python para paralelizar essa operação e melhorar ainda mais a performance. Isso pode ser especialmente útil se você tiver um grande número de subdomínios para processar.
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.

1 participant