T
T
timur1022018-02-06 18:45:40
Python
timur102, 2018-02-06 18:45:40

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

2 answer(s)
S
Sergey Gornostaev, 2018-02-06
@sergey-gornostaev

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.

S
Sergey Sokolov, 2018-02-06
@sergiks

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 question

Ask a Question

731 491 924 answers to any question