Python script speed upgrade - version 1.1

With the addition of the streak badges and expeditions to the challenge page the data upload is getting really slow. For me it takes over a minute to run the script, I timed it to 68-78 seconds. The main reason is of course the number of extra request that must be sent to Garmin. The script is doing that in series which takes forever since each request must return before the next is made.

The solution is called parallelism. Send all the requests at the same time (more or less). The Python script is now updated and sends up to 10 requests at the same time. I had to limit the number of requests due to the size of the thread pool and I do not want to mess to much with the thread pool settings. Keep it simple!

The time for the new updated script is: 14 seconds! About 5 times faster than the old script.

The time will be a little different every time and sometimes it will take longer time due to internet traffic and server load, but it will be about 4-5 times faster than the old script.

Version: 1.1

Change log:
1.1 Added threading to speed it up.
1.0 First release

Link to the script (Same path as before. Refresh the page and make sure it says version 1.1 at the top.)

The Chrome extension will hopefully also get an update with threading soon. I just have to figure out how to do it :-)


Garmin Badge Database
Garmin Connect
Change country setting

Comments

  1. Downloaded version 1.3.1. I noticed that when I run it it adds additional lines to the challenges table, and when I run the chrome extension then it removes those lines. Not a big issue, but it looks like the two use different version.

    ReplyDelete
    Replies
    1. There are some differences in the code since one is in python and one is on javascript, but should give the exact same result. For me I don't see any differences between the script or the extension. It is the exact same result.
      Could you run the python script and send me your userId so I can take a look at it? (anders@garminbadges.com)

      Delete

Post a Comment

Popular posts from this blog

Dance Fitness has arrived

September 2023 - Four (actually six) badges from the Challenge Badge Badge Challenge

The Tournament of badges - New badges will come soon!