Skip to content

Commit

Permalink
Improve performance of large number of package downloads
Browse files Browse the repository at this point in the history
For a reposync of Fedora 40, this reduces the loop in
lr_download_packages() from taking ~61 seconds to ~1second.

Signed-off-by: Stewart Smith <trawets@amazon.com>
  • Loading branch information
stewartsmith authored and kontura committed Jun 5, 2024
1 parent ba5365f commit 25ed8b6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion librepo/package_downloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,13 @@ lr_download_packages(GSList *targets,
FALSE,
FALSE);

downloadtargets = g_slist_append(downloadtargets, downloadtarget);
downloadtargets = g_slist_prepend(downloadtargets, downloadtarget);
}
/*
* Since g_slist_append() has to traverse the list to the end, we use
* g_slist_prepend() above, and reverse the lists now.
*/
downloadtargets = g_slist_reverse(downloadtargets);

// Do Fastest Mirror resolving for all handles in one shot
if (fmr_handles) {
Expand Down

0 comments on commit 25ed8b6

Please sign in to comment.