{"thread":{"id":"51165","subject":"Performance regression on git fetch in 2.21","startedAt":"2019-05-24T09:15:05Z","lastAt":"2019-06-10T13:55:43Z","messageCount":2,"participants":["Orgad Shaneh"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"376159","messageId":"CAGHpTBKSUJzFSWc=uznSu2zB33qCSmKXM-iAjxRCpqNK5bnhRg@mail.gmail.com","threadId":"51165","inReplyTo":null,"subject":"Performance regression on git fetch in 2.21","fromName":"Orgad Shaneh","fromEmail":"orgads@gmail.com","sentAt":"2019-05-24T09:14:52Z","receivedAt":"2019-05-24T09:15:05Z","isPatch":false,"sender":{"key":"orgads@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1246544?v=4"},"body":"Hi,\n\ngit fetch in my repository *when nothing new is received* takes 2.5x\nthe time when comparing 2.20 against 2.21 (on Windows it's 4x).\n\nI have 5 initialized submodules in this working directory.\n\nI reported this issue on git-for-windows github:\nhttps://github.com/git-for-windows/git/issues/2199 but there is also\nan upstream change related.\n\nI bisected and found this commit to blame:\n\nBuilding... Fetching... Failed [10.7949124]\nBisecting: 0 revisions left to test after this (roughly 0 steps)\n[a62387b3fc9f5aeeb04a2db278121d33a9caafa7] submodule.c: fetch in\nsubmodules git directory instead of in worktree\nrunning git-bisect.rb\nBuilding... Fetching... Success [4.303592]\nbe76c2128234d94b47f7087152ee55d08bb65d88 is the first bad commit\ncommit be76c2128234d94b47f7087152ee55d08bb65d88\nAuthor: Stefan Beller <sbeller@google.com>\nDate:   Thu Dec 6 13:26:55 2018 -0800\n\n    fetch: ensure submodule objects fetched\n\n    Currently when git-fetch is asked to recurse into submodules, it dispatches\n    a plain \"git-fetch -C <submodule-dir>\" (with some submodule related options\n    such as prefix and recusing strategy, but) without any information of the\n    remote or the tip that should be fetched.\n\n    But this default fetch is not sufficient, as a newly fetched commit in\n    the superproject could point to a commit in the submodule that is not\n    in the default refspec. This is common in workflows like Gerrit's.\n    When fetching a Gerrit change under review (from refs/changes/??), the\n    commits in that change likely point to submodule commits that have not\n    been merged to a branch yet.\n\n    Fetch a submodule object by id if the object that the superproject\n    points to, cannot be found. For now this object is fetched from the\n    'origin' remote as we defer getting the default remote to a later patch.\n\n    A list of new submodule commits are already generated in certain\n    conditions (by check_for_new_submodule_commits()); this new feature\n    invokes that function in more situations.\n\n    The submodule checks were done only when a ref in the superproject\n    changed, these checks were extended to also be performed when fetching\n    into FETCH_HEAD for completeness, and add a test for that too.\n\n    Signed-off-by: Stefan Beller <sbeller@google.com>\n    Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\n:040000 040000 2bad86c248b79ef1e36ea5edaa423cd73445c9a2\nad989a8f3e6f80d4f5a84ec3db0ff1ab00a7e210 M      builtin\n:100644 100644 d1b6646f42d5d12740a94f50a7d25aad4aa356bf\nb88343d977d78364b417e2015eaa352dec1501b9 M      submodule.c\n:040000 040000 a3c58919de0796b6467709a0f21fa21e28d4d13b\ncdf9514c9085efcbfcdba8efc765174f6455ce5d M      t\n\nCan you please suggest a fix? Is this the expected behavior?\n\nThanks,\n- Orgad\n"},{"id":"376927","messageId":"CAGHpTBLvVLY4YTp6c1x66WvO-OsqqTQ_-DAvBi20LFz-BG0+uA@mail.gmail.com","threadId":"51165","inReplyTo":"CAGHpTBKSUJzFSWc=uznSu2zB33qCSmKXM-iAjxRCpqNK5bnhRg@mail.gmail.com","subject":"Re: Performance regression on git fetch in 2.21","fromName":"Orgad Shaneh","fromEmail":"orgads@gmail.com","sentAt":"2019-06-10T13:55:29Z","receivedAt":"2019-06-10T13:55:43Z","isPatch":false,"sender":{"key":"orgads@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1246544?v=4"},"body":"On Fri, May 24, 2019 at 12:14 PM Orgad Shaneh <orgads@gmail.com> wrote:\n>\n> Hi,\n>\n> git fetch in my repository *when nothing new is received* takes 2.5x\n> the time when comparing 2.20 against 2.21 (on Windows it's 4x).\n>\n> I have 5 initialized submodules in this working directory.\n>\n> I reported this issue on git-for-windows github:\n> https://github.com/git-for-windows/git/issues/2199 but there is also\n> an upstream change related.\n>\n> I bisected and found this commit to blame:\n>\n> Building... Fetching... Failed [10.7949124]\n> Bisecting: 0 revisions left to test after this (roughly 0 steps)\n> [a62387b3fc9f5aeeb04a2db278121d33a9caafa7] submodule.c: fetch in\n> submodules git directory instead of in worktree\n> running git-bisect.rb\n> Building... Fetching... Success [4.303592]\n> be76c2128234d94b47f7087152ee55d08bb65d88 is the first bad commit\n> commit be76c2128234d94b47f7087152ee55d08bb65d88\n> Author: Stefan Beller <sbeller@google.com>\n> Date:   Thu Dec 6 13:26:55 2018 -0800\n>\n>     fetch: ensure submodule objects fetched\n>\n>     Currently when git-fetch is asked to recurse into submodules, it dispatches\n>     a plain \"git-fetch -C <submodule-dir>\" (with some submodule related options\n>     such as prefix and recusing strategy, but) without any information of the\n>     remote or the tip that should be fetched.\n>\n>     But this default fetch is not sufficient, as a newly fetched commit in\n>     the superproject could point to a commit in the submodule that is not\n>     in the default refspec. This is common in workflows like Gerrit's.\n>     When fetching a Gerrit change under review (from refs/changes/??), the\n>     commits in that change likely point to submodule commits that have not\n>     been merged to a branch yet.\n>\n>     Fetch a submodule object by id if the object that the superproject\n>     points to, cannot be found. For now this object is fetched from the\n>     'origin' remote as we defer getting the default remote to a later patch.\n>\n>     A list of new submodule commits are already generated in certain\n>     conditions (by check_for_new_submodule_commits()); this new feature\n>     invokes that function in more situations.\n>\n>     The submodule checks were done only when a ref in the superproject\n>     changed, these checks were extended to also be performed when fetching\n>     into FETCH_HEAD for completeness, and add a test for that too.\n>\n>     Signed-off-by: Stefan Beller <sbeller@google.com>\n>     Signed-off-by: Junio C Hamano <gitster@pobox.com>\n>\n> :040000 040000 2bad86c248b79ef1e36ea5edaa423cd73445c9a2\n> ad989a8f3e6f80d4f5a84ec3db0ff1ab00a7e210 M      builtin\n> :100644 100644 d1b6646f42d5d12740a94f50a7d25aad4aa356bf\n> b88343d977d78364b417e2015eaa352dec1501b9 M      submodule.c\n> :040000 040000 a3c58919de0796b6467709a0f21fa21e28d4d13b\n> cdf9514c9085efcbfcdba8efc765174f6455ce5d M      t\n>\n> Can you please suggest a fix? Is this the expected behavior?\n>\n> Thanks,\n> - Orgad\n\nping\n\n- Orgad\n"}]}