I have a gaming laptop and a phone, both of which have USB 3.2 Gen 2 and Gen 1 ports. I also use a USB 4 Type-C cable. Now, recently, I have downloaded music files of over 300GB. If I transfer them one by one, it takes a lot of time. Today, I compressed the folder to a single zip file, and the transfer finished in less than 20m. Why is that so?

  • autriyo@feddit.org
    link
    fedilink
    English
    arrow-up
    7
    ·
    4 hours ago

    Androids storage doesn’t show up as mass storage since quite a while ago. Instead it uses MTP which in my experience is slower and way less reliable.

    Maybe that’s also part of the reason?

  • Freakazoid@lemmy.ml
    link
    fedilink
    English
    arrow-up
    29
    ·
    8 hours ago

    It has probably something to do with the large quantities of individual files.

    It works through the list of files one by one. The indexing, writing and checking of individual files takes longer than one single .zip file. Thus zipping them first increases the overall speed.

    • deranger@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      2
      ·
      4 hours ago

      Isn’t this just going to be happen when the zip is decompressed, thus not saving time? I would actually expect it to be worse, since now you’re reading and writing from the same drive instead of reading from one, and writing it to another.

      • MotoAsh@piefed.social
        link
        fedilink
        English
        arrow-up
        5
        ·
        edit-2
        2 hours ago

        No, there’s a massive difference between doing something local and doing something over a hotpluggable connection.

        USB by default, especially in Windows, does a lot of extra work to make sure nothing gets corrupted in transit, and that if the cable comes unplugged, nothing gets corrupted.

        When you unzip on your local system, it’s just like sending an accountant into the back to unbox something. It’s one process, going as fast as they can, with local resources ready at hand.

        When transferring a ton of files over USB, it’d be more like asking someone over the phone to send the contents of the box over, one by one. So now you have someone on the far end rummaging around for stuff meant for the box, packaging it up and sending items off one by one, telling a second person at the receiving end about each in turn, and only moving on once the receiver confirmed that one item came across OK.

        The difference is insane. It’s probably even more overhead than the above example implies.

        • deranger@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          1
          ·
          edit-2
          49 minutes ago

          This does not match my experiences. Transferring files over USB would absolutely be faster than sending a zip and unzipping it on a flash drive. I can easily do 300MB/s over USB3.2 when transferring music files.

          Unzipping a large file is going to be a bunch of reads and write and the large file is going to transfer at the exact same speed as the smaller music files, which are not “small”, they’re still tens of MB. So, the zip and music files take roughly the same time except now you have to wait to unzip with one large file. It does not save time.

          Transferring tens of thousands of 1kb files will slow things down, and I’d zip this, but music files are big enough.

  • Rivalarrival@lemmy.today
    link
    fedilink
    English
    arrow-up
    3
    ·
    5 hours ago

    Syncthing

    Self-hosted. Open source. Your data stays on your own devices. Creates a shared folder on your laptop and your phone. Move a file into that folder on your laptop, and syncthing pushes it to your phone.

  • mushroomman_toad@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    8
    ·
    7 hours ago

    for each file, the computer has to ask the phone about the file, wait for the phone to process the file request, and respond. Then it can start transferring the file. With a single file, it can copy everything in one go without stopping.

    You’re basically being bottlenecked by your phone’s CPU, and by high latency in a single-threaded task.

    • MotoAsh@piefed.social
      link
      fedilink
      English
      arrow-up
      3
      ·
      2 hours ago

      No, is not the phone’s CPU. I guarantee you that can process several gigabytes a second.

      It’s the overhead of all that handshaking and confirmation coming over USB, and having to be verified with the sometimes slow phone storage chips or worse on a microSD.

      It’s IO overhead and waiting all over the place, not a CPU bottleneck.