Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My advice is not to "guess" what is slow, but use a profiler and <em>measure</em> where the CPU is burnt. I suspect you may be surprised.</p> <p>WinHTTP is not slow, and does not use a lot of CPU by itself. It is much faster than WinINet, and is working very well (at least with the flat C API - or are you using the COM interface?). Perhaps there is something wrong in your code.</p> <p>About your questions:</p> <ol> <li><p>Writing chunk size of 8192 bytes does make sense, and won't be much faster (when compared to the HTTP stream downloading speed) if you use a bigger buffer. Windows file system usually write data on disk by 4 KB, and will do the buffering all by itself. Just try to make it bigger (e.g. 65536) but I don't think change will be noticeable.</p></li> <li><p><code>Synchronize</code> is not so awful. What you can do is to call it only if you change for some percents (e.g. every 5% or 10%) instead of each time. You can do that inside the downloading thread, just by adding a private variable containing the latest notified size.</p></li> </ol> <p>Another possibility could be to use some read-only properties (<code>DownloadedSize + TotalSize: Int64</code>) to the thread class, then update their content during the downloading. Then use a <code>TTimer</code> - or create a custom message (<code>WM_USER+...</code>), then use <code>PostMessage()</code> in the downloading thread - in the main GUI thread to refresh the progress bar if needed, for each thread. This is safe to <em>read</em> some property from the main thread.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload