I've noticed that downloading a file using VSCode seems to be significantly faster than running the same download script in the terminal. I'm using Invoke-WebRequest for both methods; it's the same script, just initiated from a GUI. Is this a known issue or an expected behavior?
3 Answers
How much faster are we talking? I did a quick test myself. I downloaded a file using both methods: VSCode took about 71 seconds, while the terminal took over 2050 seconds. That's a huge difference! It might be the way VSCode handles downloads compared to the terminal.
One reason could be the progress indicator in PowerShell, which can slow down the download. If you use `$ProgressPreference = 'SilentlyContinue'`, it turns off the progress notifications and might improve the speed. I found that both methods should perform similarly when the progress display isn't affecting I/O performance.
Yeah, I've heard that progress bars can really bog things down. I saw a method to update them less frequently, which helps a bit.
It's kinda strange, right? I noticed different speeds when using `Invoke-RestMethod`, `Invoke-WebRequest`, and `System.Net.WebClient`. In my last script, the WebClient was way faster — ten times faster, in fact. Anyone know why they vary so much?
I get what you mean; I’m just learning PowerShell myself!
Interesting! How did you format that code block with the curly quotes? I've only seen standard single quotes before.