Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why Firefox is four times faster to download zip file then my own Java program?

 
Boris Osipchuk
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried using regular IO or NIO but Firefox always beats it by being about 4 times faster. Is there something special they are using?
For example, I tried downloading eclipse distributions and needed about 40 minutes for like 360 MB and Firefox did in 10 minutes.
I will post the code, if requested, but hope this is something beyond my code.
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps Firefox uses multiple connections to download from, then pastes the contents together on your PC.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's see your loop for actually reading/ writing, and maybe something will jump out at us. I suspect some of that speed comes from using multiple buffers in rotation, and reading and writing from dedicated threads, but there are some very basic things -- using a large - enough buffer, for example -- that can make a difference.
 
Boris Osipchuk
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, I have tried to break it up into four threads, as Rob suggested, by I don't know multi-threading very well, so what I get is I can see that 4 files are being created but only one file is being populated with data. After that is done the application terminates and 3 other files don't contain any data.
Here's my downloader class.



and here's how I call it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!