News for hackers. Stuff that matters.
Re:Visual Studio 2013 by CoolGuySteve on Monday June 03, 2013 @09:49PM (#5817231)
I work on an extremely latency sensitive application. The choice of Windows predates me, and frankly, it was a massive mistake. I am never working on Windows again after this job.

Here's some feedback for low latency development in Visual Studio. Try not to take it personally, I don't hate you, I just hate every MSVC I've ever used:

- With a profiler, we typically see only a few hundred samples in our simulation runs, the rest, between 99.999% and 99.99999% of the samples are in WaitForSingleObject. PGO compiles only 0.4% of our application for speed, and our response times are about 20 usecs slower with it on.

- RE xperf (and WinDbg): Stop bundling this shit in "Toolkits". The installers/downloaders are buggy as fuck and break the main VS2012 installer; I don't want to run a bunch of random msi files on our prod server core box; and the download pages are a maze of redirects.

- __assume is so useless. How often does someone write a branch that does nothing every time? We need manual size/speed optimization.

- PogoAutoSweep crashes threaded programs if you don't suspend every other thread but it's still quasi documented. The PogoSafeMode build flag/environment appears to be ignored.

- The filename postfix that PogoAutoSweep adds breaks the VS2012 PGO menu options.

- The VS2012 PGO instrumented/optimized menu items overwrite the target exe. So when you realize somethings wrong in the environment or click something by mistake and didn't manually reshuffle the build dir, you have to rebuild everything. Name the target .instrument.exe or put it in another or something please.

- There's nothing one can do to limit the VS2012 profiler to specific threads. I was able to write hooks to target threads in VerySleepy in an afternoon, but somehow this feature escapes MS.

- The interface for instrumenting specific functions is terrible, use a plain text file or decl_spec FFS.

- If there are #defines or other ways to detect an instrumented build, they're terribly documented.

- PGO instrumentation/optimization is woefully obtuse. What did it pick for speed? Why did it pick it? What branches did it fold/unfold? How does the pgc weighting actually work? Can I artificially create my own pgc?

A perl script that compares the offsets in objdump will give me more information than most of the MSDN articles about this shit.

- Not related to our main response loop, but we can see in our logging threads that the LFH malloc appears to often call RtlAnsiStringToUnicodestring. Seriously, what the fuck?

- Speaking of which, changing the malloc implementation is still horrible even after the VS2010 msvcrt changes. In linux, you can change LD_PRELOAD and try out tcmalloc or the Intel tbb allocator in about 3 minutes. In Visual Studio, prepare to spend a few hours getting a reasonably large project to build with these.

- Why is there SemaphoreSlim in C# but not C++? Why is there no Benaphore primitive that can also be used in WaitForMultipleObjects?

- Serious issues in Microsoft Developer Connect are often ignored, closed as behaves as expected, or dismissed off hand. For example, I was tearing my hair out over this one, and the resolution is truly outrageous: http://connect.microsoft.com/VisualStudio/feedback/details/7...

I am certain that this comment on Hacker News will make a bigger impact than anything I've ever seen on Microsoft Connect.

- RE Instrumenting profilers/bounds checkers: Any project that is reasonably large and has multiple configs/3rd party libraries is bad enough to manage in vanilla Visual Studio that instrumenting it with some other 3rd party plugin becomes a serious time sink.

- There is still no valgrind/cachegrind equivalent that provides the same level of detail. The closest thing is either Intel Pin or Rational Purify/Quantify and they are expensive and poor substitutes. Microsoft is the only company that can see and modify the source of the kernel, runtime, linker, and machine code generation, so I don't know who else they expect to write this for them.

- Our statically linked application takes 20 minutes link and the link is not parallel. C++ compiles are likewise brutally slow. We resort to developing in VS2008 and compiling release stuff in VS2012. And no, I'm not going to turn on precompiled headers, MSVC builds incorrect binaries about 5% of the time as it is.

- Concerning precompiled headers, sharing a single pch file across projects or strictly controlling a single vcproj/vcxproj with the compiled unit is de facto impossible.

Re:Visual Studio 2013 by idwhence on Tuesday June 04, 2013 @03:10AM (#5818091)
On a related topic - may I seriously ask how we as a community of technologists can help change the tone directed at our brothers and sisters in code? It's no wonder more people from Microsoft don't bother engaging when the first (so far only) reply is a hostile tirade about random collection of complaints that have nothing to do with the person being replied to.
Re:Visual Studio 2013 by CoolGuySteve on Tuesday June 04, 2013 @07:19AM (#5818724)
While you make a valid point about the tone (this specific area has wasted the last 2 weeks of my life), I think you're being disingenuous regarding the " random collection of complaints that have nothing to do with the person being replied to" comment.

This person works on PGO and code generation and wanted feedback. Everything I said related to PGO, instrumentation, or parts of the CRT that relate to that (and one about their broken feedback system).

Re:Visual Studio 2013 by com2kid on Tuesday June 04, 2013 @03:53AM (#5818196)
I'll be perfectly honest, when I was working on the MS compiler team (for CE), I just sort of got used to it.

But yes, thick skin is required for those who self identify!

Then again I have always held the view that if my users are unhappy, it is a personal failing on the part of my team and myself. (Although I am low enough on the software engineering totem poll that I can't really do anything outside of ensure components I create are as user friendly and high quality as possible!)

Re:Visual Studio 2013 by malkia on Tuesday June 04, 2013 @01:29AM (#5817893)
I also have this gripe - why every version of Visual Studio has to change so much drastically the CRT version, thus requiring new DLL and breaking all plugins that happen to be linking to some other version.

This basically means, if you are using (say) Autodesk products, you have to compile all your plugins with exactly the same version the main product (exe) was compiled.

This is absolute mess. Talk about 7 different MSVCRxx.DLL and MSVCPxx.DLL in one process.

Why can't you think of scheme where backward compatibility works for the CRT/C++RT too?

Oh, and on naming things - please stick with VS2012 -> CRT2012 if possible.

Also why ShortName / PlatformName in VisualStudio is named so crazy - one amd64/x64 vs Win32/x86 - and then SDK's coming from Microsoft would place in the lib/ folder things sometimes with lib/$(ShortName) and sometimes with lib/$(PlatformName).

I know why - because these things are not important. Just hard-code it in your .vcxproj and live a happier life :) Automation begone!

Re:Visual Studio 2013 by terrymah on Tuesday June 04, 2013 @01:41PM (#5820923)
> PGO compiles only 0.4% of our application for speed, and our response times are about 20 usecs slower with it on

This is a complex issue, but consider abandoning PGO and just compiling for for speed then. PGO doesn't help in each and every case.

> RE xperf (and WinDbg): Stop bundling this shit in "Toolkits".

How else would you bundle it? It's not simple to put something as part of the base OS image. And I haven't heard about these installers breaking the VS installer - that sounds like a bad bug.

> __assume is so useless. How often does someone write a branch that does nothing every time?

It's commonly used as a retail version of a debug ASSERT macro. But yes, like I said earlier - I wish we would do more with static annotations, but I've gotten push back.

> PogoAutoSweep crashes threaded programs if you don't suspend every other thread but it's still quasi documented. The PogoSafeMode build flag/environment appears to be ignored.

I've never seen PogoAutoSweep crash - do you have a repro? PogoSafeMode doesn't affect PogoAutoSweep, only probe generation.

> The filename postfix that PogoAutoSweep adds breaks the VS2012 PGO menu options.

Haven't heard of this either, but stay tuned. I don't like the PGO menu options as they currently stand.

> There's nothing one can do to limit the VS2012 profiler to specific threads.

I can forward that request to the profiler team.

> The interface for instrumenting specific functions is terrible, use a plain text file or decl_spec FFS.

Are you talking about PGI or an instrumented profiler?

> If there are #defines or other ways to detect an instrumented build, they're terribly documented.

There isn't an easy way, and having different code in the PGI build versus the PGU build would be problematic.

> PGO instrumentation/optimization is woefully obtuse. What did it pick for speed? Why did it pick it? What branches did it fold/unfold?

Stay tuned

> How does the pgc weighting actually work?

The obvious way, the counts are multiplied by the provided factor before being merged in the PGD.

> Can I artificially create my own pgc?

Not realistically.

> Not related to our main response loop, but we can see in our logging threads that the LFH malloc appears to often call RtlAnsiStringToUnicodestring.

No idea (CRT owns malloc, Windows owns LFH).

> Speaking of which, changing the malloc implementation is still horrible even after the VS2010 msvcrt changes. In linux...

I'm not an expert, but my understanding was that malloc and friends were weak symbols, and if you just linked in an obj that defined malloc it would be selected as the "real" malloc without giving an ODR.

> Why is there SemaphoreSlim in C# but not C++? Why is there no Benaphore primitive that can also be used in WaitForMultipleObjects?

I'm not sure, Windows owns this.

> Serious issues in Microsoft Developer Connect are often ignored, closed as behaves as expected, or dismissed off hand

I've heard complaints about MSConnect before as well. All I can say is that it is the correct place to file bugs; and the issues there do directly show up in our bug list (someone goes through connect issues, filters/combines them, and files bugs).

> There is still no valgrind/cachegrind equivalent that provides the same level of detail

That is correct. Sorry.

> Our statically linked application takes 20 minutes link and the link is not parallel. C++ compiles are likewise brutally slow

Link.exe performance is at the top of our minds right now, you're not the only one to bring it up. VS 2013 will have some perf improvements across the FE (to help with C++ being brutally slow) but there is always more to do.

> And no, I'm not going to turn on precompiled headers, MSVC builds incorrect binaries about 5% of the time as it is.

Never heard that before - codegen bugs are always deadly serious and treated with high priority. If you have a repro, please share it.