For VS2010 (C++) what causes the long delay between clicking on "Build" and when the build actually starts? - visual-studio-2010

I have a simple one-project solution in C++. From the IDE I click on Build Solution and it takes 40 seconds before anything happens. Then 17 seconds to actually do the compiling and linking. If I click Build Solution again, there is another 40 second delay. devenv.exe is busy doing something as it is using 13% of my total CPU during this time.
If I call msbuild directly, it starts immediately. And it doesn't recompile unless it is truly out of date. So it doesn't seem to be a problem with msbuild at all.
I have Googled and chased down lots of articles, but most of them talk about why msbuild is slow or failing, not why the IDE is slow to call msbuild. I've even got an external tool setup using msbuild and it starts immediately. BTW, that tool is based on this:
http://www.hanselman.com/blog/HackParallelMSBuildsFromWithinTheVisualStudioIDE.aspx
I have checked for missing files using the devenv.exe.config change and I do get items like:
devenv.exe Information: 0 :
Project 'C:\Users\...\XFPMon\XFPMon.vcxproj' not up to date because 2 build outputs were missing.
devenv.exe Information: 0 :
up to date is missing: 'C:\WINDOWS\TEMP\AEXAM\AEX7C29.TMP'
devenv.exe Information: 0 :
up to date is missing: 'C:\WINDOWS\TEMP\AEXAM\AEX7C28.TMP'
The change to devenv.exe.config was to insert these:
<system.diagnostics>
<switches>
<add name="CPS" value="4" />
</switches>
</system.diagnostics>
and then use DbgView to trace the output during the build. I cannot imagine why devenv.exe would think that TEMP files would be saved between builds.
I have even deleted the Debug and Release directories and compiled from scratch. Still the 40 second delay.
If I do a Rebuild Solution, another 40 second delay.
But if I do a Clean Solution, it runs instantly!
Does anybody have a clue as to what is causing the delay?
Thanks!
EDIT:
Further information. I have 8 cores, 12 GB RAM, and a 256 GB SSD, so this little machine has the raw horsepower.
When devenv.exe is in the 40 second delay period, it is drawing a total of 13% of the CPU. When the compilation starts, it drops to less than 1%. The memory usage changes very little. It starts at 458.2MB, rises to 459.9MB during the 40 second delay, and then jumps to 463.1MB immediately after the compilation (if any) finishes.

Well, I found the problem. An Addin was taking exponential time to process the .rc and .rc2 files. The Addin was put in many months ago and did not start showing this problem until the size of .rc file grew enough to cause the (poorly-designed) regex to run very slowly.
Worse, I wrote the Addin! And have been using it on several machines for about a year with no problems. Previous versions of the Addin were written in C++ using PCRE regular expressions and never had a problem (even after 5 years of use). But this was a rewrite using C# and .NET Regex, which apparently behaves differently.
I fixed the problem by rewriting the code to avoid the need for some of the backtracking. Simple enough to do, but irritating that it was necessary for C# Regex.
The key to discovering the problem was to start devenv.exe with the /resetaddin option. With this, a build starts immediately. Then it was just a matter of figuring out which addin. I just hadn't done this as I hadn't changed addins for months.
This problem showed up when the .rc file was as small as 12K. I have tested the new version on a 262K .rc file and it runs in 123 ms.
Sigh.

Related

Xcode 9.2 is re-indexing from scratch each time I open it, even if nothing changed

I have a project (big project), that takes about 30 minutes to be indexed by Xcode. Xcode consumes 100% of my CPU for 30mn.
OK why not, that sounds a bit rude to use 100% of the CPU for a background task, but why not.
Now, if after 30 minutes, I quit Xcode, and re-open it, without touching a single file of my project, it starts again to index for 30 minutes.
Is this the intended behaviour? Is there a way to fix it? I don't want to turn off inedxing, I tried it, and code completion is HS.
Try adding this flag to your build settings.
Xfrontend -warn-long-expression-type-checking=400
It will cause warning where the compiler take a long time to deduce a complex expression.
This may cause a build error which will go away after you find the slow expressions and then remove the build flag.

VS2010 refuses to build when system time moved backward

I have problem with the windows time and date of my computer, which randomly go backward to when the machine turned on. When this happens, anything I changed in the source files will not be compiled and vs just says "xxx.exe - 0 errors,0 warning" or "0 succeed 0 failed 1 up-to-date, 0 skipped". Rebuild solution will result in loss of precompiled header then a full rebuild. And it is difficult to keep the time running forward. Is there any other suggestions on a fast build when the time goes wrong?
Sorry for my poor English
VS2010 is doing what it's designed to do. A correctly functioning clock is a prerequisite for every build system.
So move the clock forward before you save any cpp files. Create an icon for visual studio corresponding to a batch file which syncs the system clock and then launches devenv if you must (see more here: https://superuser.com/questions/323581/synchronize-internet-time-in-a-windows-script ; or https://superuser.com/questions/15596/automatically-run-a-script-when-i-log-on-to-windows )
If you refuse to fix this right, then you will experience nonstop pain and build confusion. So I suggest you fix it right. If you don't want to fix it:
In solution explorer, right-click the c++ file you just saved and pick 'compile'. It will build again without respect to the timestamps
Or, you can manually delete the .obj files you want to rebuild. "del Debug*.obj" for instance would delete all of them without affecting the PCH.

Externally generated projects(premake/cmake) lock up VS2015

I'm using premake5 here.
It generates my solution/project files, when this happens, VS2015 asks me if I want to reload the modified projects.
If I hit yes, this proceeds to lock up the IDE for a very long time.
Anywhere from 30 seconds to 1 minute I'd say.
Does anyone know of a way to work around this? This is super irritating.
It happens even for the most trivial of changes(modify one project, which only has 1 file in it).
I realize this is a VS problem, and not directly the fault of premake/cmake(or whatever build system you are using), but it totally sucks.
As you said, it's VS related :) But I think you have some problems with your installation : for small projects, reloading the whole solutions should be pretty fast : my personal projects take less than a second to reload (2 to 4 projects per solution, ~100 files per project)
Anyway in the usual course of development, re-generating your projects should not happen that often, except at the very beginning when you need to configure everything.
When you need to add a few files, just add them through Visual Studio : you won't have to run Premake again, and next time you run it, the files will be included by your script anyway. You can do the same with small configuration changes : update your project directly in VS, check that it works, and when it does, upadte the Premake script. You won't have to run Premake then.

Idea 14 and 15 is sometimes irritatingly slow in editor. How to fast?

I found that IntelliJ Idea sometimes is becaming irritatingly slow.
Sometimes it is not VERY slow, but sometimes it is slow like bad web page. The impression that is think and waits on each keystroke or each word.
Much slower than Visual Studio.
The speed was one of the main reason I switched from Eclipse. I would not like if IntelliJ will turn to the same as Eclipse but for money.
Are there any means to speed up an IntelliJ?
I have added
editor.zero.latency.typing=true
into idea.properties but had no effect.
UPDATE
Already set
but this didn't help.
UPDATE 2
I found that slowness depends on what is written in code. I.e. it is somehow related with automatic code inspection or something.
I don't want to disable inspection completely, but just don't want it runs each keystroke. Is it possible to increase delays somewhere?
Please report your problems in Jetbrans's youtrack. Usually you need to provide your CPU Usage profile. How to enable it you can read here: Reporting performance problems
If you have a 64-bit machine, you can launch IntelliJ IDEA from idea64.exe, not idea.exe
Second thing, as the comment suggests, you can edit your idea64.exe.vmoptions (that's spelled correct, .vmoptions is the file extension, while .exe is part of the filename) in pathToIntelliJ/bin by increasing values in lines starting from -Xms and -Xmx (that is: memory for JVM while starting and maximum amount of memory). You may not be able to edit this file in place, but you can copy this file to another location (where you have permission to edit it), edit this file and copy it back to /bin folder.

Typescript compilation becomes slow - WebStorm

Since some days I see that the typescript compilation is becoming slower and slower. Compile a single file with webstorm file watcher took me around 1-4 sec, but I added many TS files (75 now, and I think that's not really a lot...) and the compilation time is about 10sec for a simple file.
If I need to change of branch or update a definition, it can become around 5 minutes. My computer is really powerful (game computer) and I don't get why it's becoming slow like that.
All files are compiled one by one, the webstorm way... And if the server is running at the same time with a watcher, it becomes crazy because restart maybe 50 times. (Obviously, I shut it down, but it's not really useful to have a watcher if I need to shut it down...)
Any idea? I took a look to several discussions like mine but so far I didn't really found any workaround.
You could point the file watcher to grunt task that compiles all your files in a single pass. E.g. grunt-ts : https://github.com/basarat/grunt-ts compiles all your files in one command to tsc.
PS disclosure: I am one of the authors of grunt-ts

Resources