What is 'only one line of code' that reduces program execution time by 99%?
Program execution speed and website display speed require the pain of many engineers to improve in just a few seconds, but sometimes they can be overwhelming and dramatic. Image-sharing service
How a one line changed decreased our build times by 99% | by Pinterest Engineering | Pinterest Engineering Blog | Oct, 2020 | Medium
https://medium.com/pinterest-engineering/how-a-one-line-change-decreased-our-build-times-by-99-b98453265370
The reduction in execution speed was achieved by the 'Engineering Productivity Team' that assists engineers in building and deploying software within Pinterest. Pinterest operates six GitHub repositories, 'Pinboard,' 'Optimus,' 'Cosmos,' 'Magnus,' 'iOS,' and 'Android,' the oldest of which is the Pinboard repository. It is a huge repository with over 350,000 commits and a data size of over 20GB when cloned in its entirety. The engineering productivity team also maintains these repositories and more.
Pinterest is building and deploying software with automation tool Jenkins , placing the following code at the beginning of a series of automated processes and cloning the latest package from the GitHub repository. 'Depth: 50' to get only the latest 50 commits, 'shallow' option to get only the latest commit history, etc. are specified, so that it is devised to speed up cloning of a huge repository. I can see.
Below is an improved version of the above code. The red frame 'refspec:'+ refs / heads / master: refs / remotes / origin / master'' has been added.
Added in the improved code is a ' refspec ' option that allows you to specify the range of branches to process, etc. According to the Git specifications, if you clone without specifying the refspec option, all branches in the remote repository will be fetched and the commit history will be acquired. In the case of the Pinboard repository, before the improvement, it was inefficient to fetch all 2500 or more branches existing in the repository and then clone the master branch. In the improved code, refspec limits the fetched branch to the master branch.
With this one-line change, the time it takes to clone the repository has been reduced by 99%, from 40 minutes to 30 seconds. The overall speed of building software has also improved dramatically. 'It's our job to understand that one line of difference can sometimes make a big difference,' said a member of the Engineering Productivity team at Pinterest.
Related Posts:
in Software, Posted by darkhorse_log