Building/Linking with MSVC seems to be extremely slow (When using Cmder/ConEmu)


#1

Hi folks,

I’m curious if any of the other folks out there using msvc and rust have found builds to be almost insanely slow.

With the same laptop running linux, the builds weren’t anything unusual.

Since I’m relatively new to doing any kind of daily dev work on Windows I was wondering if this wasn’t perhaps an obvious tool configuration problem that the uninitiated stumble upon.

My general workflow is to run cmder, initialize the environment with vcvarsall (which takes an insane amount of time in it’s own right), then run emacs from that shell. I start my builds using cargo with projectile.

I’m generally comfortable and happy with all of this workflow, but if I could improve the build/link times it would be a major QoL improvement.

I’m using Windows 10 and VS 14. I’ve just started using rustup instead of the official installer, but either perform the same. The version of rustc is 1.8.0-msvc.

Cheers!


#2

Vcvars init is like ~1 sek for me so that sounds odd.

In general I have no problem at all using the MSVC version of Rust.


#3

hrmm… this must be some bad juju with cmder then. :confused: I just ran vcvars under a vanilla cmd.exe and it was totally snappy.


#4

I believe you’re correct that this is something to do with cmder. I tested in PowerShell and vcbuildtools.bat was nearly instantaneous, but running the same script in a cmder window took several seconds. The real problem will be tracking this down since cmder is a wrapper around ConEmu and clink.


#5

I’ve opened an issue about this: Batch File Slow to Load


#6

well it’s a bummer but I will survive!

cmd.exe is the worst when you’ve been using linux for decades. :stuck_out_tongue:


#7

PowerShell isn’t bad as a replacement, and the startup times on Windows 10 are vastly improved. It also supports VT100 colors with Windows 10, woohoo!

But cmder makes life much nicer.

I’ll probably go about creating an alias that I can use to run vcbuildtools.bat when I actually need it, rather than during shell startup.


#8

Powershell looked promising but it as far as I can see lacks support from Visual Studio (aka I havent seen any vcvarsall.ps1).

I’m perma-banning ConEmu anything from my life now, ConsoleZ seems to behave fine (haven’t timed anything yet), but I’m honestly ok with a custom shortcut to a standard windows prompt for now. Things work faster, life is better etc.


#9

Link for those who may be interested in testing ConsoleZ


#10

Powershell looked promising but it as far as I can see lacks support from Visual Studio (aka I havent seen any vcvarsall.ps1).

Do I have a workaround for you!

In writing my glorious blog post Installing Rust on Windows, I discovered that you can use an Invoke-CmdScript.ps1 module to get what you need.

I used the recipe Retain Changes to Environment Variables Set by a Batch File in the PowerShell Cookbook. (You should totally buy the book if you like that code snippet, there’s lots more PowerShell in there that you won’t have to write.) Anyway – after saving that recipe to a file, I had to add the following to my PowerShell profile: Invoke-CmdScript.ps1 "C:\Program Files (x86)\Microsoft Visual C++ Build Tools\vcbuildtools.bat" amd64


#11

Thanks for this!


#12

Awesome, bookmarked the post and will experiment with Powershell more. At the moment ConsoleZ seems like the winner for me unless we discover something to improve the cmder experience.

For those who might not know, apparently to have a terminal program in Windows that works as well as what we’ve had in Linux/Unix land since the late 90s; it’s required to actually inject hooks into the system for at least the top level process.
ConEmu (by extension then Cmder) uses many deep hooks to provide features and this incurs a bit of overhead.

ConsoleZ only uses a single hook by comparison. So for me, getting a tabbed terminal interface with ConsoleZ is at least a nicer alternative to 20 cmd.exe windows but I do certainly miss the great stuff you get with cmder.


#13

For anyone finding this thread in the future, the poor performance problem described here (and in Batch File Slow to Load in ConEmu) as fixed as of ConEmu build 160609. My profile execution times are approximately the same, as is the execution of vcbuildtools.bat.