{"thread":{"id":"55607","subject":"\"Unpacking objects\" question","startedAt":"2021-05-02T11:07:03Z","lastAt":"2021-05-03T01:22:13Z","messageCount":3,"participants":["Bagas Sanjaya","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"423444","messageId":"bdd50fcc-02c3-dc24-9d49-773db881b65d@gmail.com","threadId":"55607","inReplyTo":null,"subject":"\"Unpacking objects\" question","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2021-05-02T11:06:57Z","receivedAt":"2021-05-02T11:07:03Z","isPatch":false,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"Hi,\n\nRecently I stumbled upon git unpack-objects documentation, which says:\n\n> Read a packed archive (.pack) from the standard input, expanding the objects contained within and writing them into the repository in \"loose\" (one object per file) format.\n\nHowever, I have some questions:\n\n1. When I do git fetch, what is the threshold/limit for \"Unpacking objects\",\n    in other words what is the minimum number of objects for invoking\n    \"Resolving deltas\" instead of \"Unpacking objects\"?\n2. Can the threshold between unpacking objects and resolving deltas be\n    configurable?\n3. Why in some cases Git do unpacking objects where resolving deltas\n    can be done?\n\nThanks.\n\n-- \nAn old man doll... just what I always wanted! - Clara\n"},{"id":"423448","messageId":"YI7Zl+odFFRIZ7aL@coredump.intra.peff.net","threadId":"55607","inReplyTo":"bdd50fcc-02c3-dc24-9d49-773db881b65d@gmail.com","subject":"Re: \"Unpacking objects\" question","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-05-02T16:55:51Z","receivedAt":"2021-05-02T16:55:53Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, May 02, 2021 at 06:06:57PM +0700, Bagas Sanjaya wrote:\n\n> Recently I stumbled upon git unpack-objects documentation, which says:\n> \n> > Read a packed archive (.pack) from the standard input, expanding the objects contained within and writing them into the repository in \"loose\" (one object per file) format.\n> \n> However, I have some questions:\n> \n> 1. When I do git fetch, what is the threshold/limit for \"Unpacking objects\",\n>    in other words what is the minimum number of objects for invoking\n>    \"Resolving deltas\" instead of \"Unpacking objects\"?\n> 2. Can the threshold between unpacking objects and resolving deltas be\n>    configurable?\n\nSee the fetch.unpackLimit config. The default is 100 objects.\n\n> 3. Why in some cases Git do unpacking objects where resolving deltas\n>    can be done?\n\nI don't know if the documentation discusses this tradeoff anywhere, but\noff the top of my head:\n\n  - storing packs can be more efficient in disk space (because of deltas\n    within the pack, but also fewer inodes for small objects). This\n    effect is bigger the more objects you have.\n\n  - storing packs can be less efficient, because thin packs will be\n    completed with duplicates of already-stored objects. The overhead is\n    bigger the fewer objects you have.\n\nWhich I suspect is the main logic driving the object count (I didn't dig\nin the history or the archive, though; you might find more discussion\nthere). AFAIK the number 100 doesn't have any real scientific basis.\n\nThere are some other subtle effects, too:\n\n  - storing packs from the wire may make git-gc more efficient (you can\n    often reuse deltas sent by the other side)\n\n  - storing packs from the wire may produce a worse outcome after\n    git-gc, because you are reusing deltas produced by the client for\n    their push (who might not have spent as much CPU looking for them as\n    you would)\n\n-Peff\n"},{"id":"423453","messageId":"xmqq5z00bohs.fsf@gitster.g","threadId":"55607","inReplyTo":"YI7Zl+odFFRIZ7aL@coredump.intra.peff.net","subject":"Re: \"Unpacking objects\" question","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-03T01:22:07Z","receivedAt":"2021-05-03T01:22:13Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> I don't know if the documentation discusses this tradeoff anywhere, but\n> off the top of my head:\n>\n>   - storing packs can be more efficient in disk space (because of deltas\n>     within the pack, but also fewer inodes for small objects). This\n>     effect is bigger the more objects you have.\n>\n>   - storing packs can be less efficient, because thin packs will be\n>     completed with duplicates of already-stored objects. The overhead is\n>     bigger the fewer objects you have.\n\nAnother original motivation was to avoid ending up with too many\nsmall packs, as it would result in accessing objects taking\npotentially order of number of packfiles in the repository in the\npre midx world.  After many small fetches, gc would be able to pack\nthem all into a single pack.\n\n> There are some other subtle effects, too:\n>\n>   - storing packs from the wire may make git-gc more efficient (you can\n>     often reuse deltas sent by the other side)\n\n - storing and using packs that came from the wire may not have as\n   good locality among objects, especially when the other side was a\n   server that is optimized to reduce outbound network bandwidth\n   (read: size) and their own processing cycles (read: object reuse\n   from their packs).  Local packing has a dedicated phase to\n   reorder the objects to pack related ones close to each other, but\n   the \"server\" side has no incentive to optimize for that.\n\n>   - storing packs from the wire may produce a worse outcome after\n>     git-gc, because you are reusing deltas produced by the client for\n>     their push (who might not have spent as much CPU looking for them as\n>     you would)\n"}]}