Answer the question
In order to leave comments, you need to log in
How to speed up a python program (vkapi)?
Hello. I made a program that parses all the posts of a group / person, but it works very slowly (0-7 minutes). See how many posts. How can you customize the program? Someone said to use hashing, but I don't understand how to apply it (is it necessary at all?)
Answer the question
In order to leave comments, you need to log in
Any optimization starts with profiling . When you have information about which sections of the program are executed at what speed, it will become clear what and how to speed up.
Where is your bottleneck: in getting posts one at a time, no more than 3 per second? Use the execute() method - there you can collect requests in batches of up to 25 requests to the VK API. Total 75 per second.
If you are making requests with tokens of not one, but several accounts, then you can parallel requests, for example, with Octopus HTTP
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question