locked
UWP with C++/Cx library builds slow RRS feed

  • Question

  • Hi. I am developing a WinRT wrapper of my company's c++ library on UWP using C++/Cx. Lib size is arround 30MB. To test it I've created a test app and unit tests to see if it works. But during this development I faced a really bad perfomance of my project building. 

    In my solution I have a separate projects for each part but looks like the most of the compilation time takes to build a test application (or unit test app). The bad thing is that even if I made a few changes in Xaml (or no changes at all) in my test app, the build time takes about 2 minutes. Bin/obj folders of the app is more than 100MB size even for a really small test app.

    As far as I know windows runtime component cannot be build to a separate library aside from the project that imports it. So each time when I try to build my app it pulls the native lib and wrapper, and makes some magic which takes a while in a building time. 
    Is there any way how I can reduce the building time? Or at least build a complete part (the wrapper) separatly from the test app and than include it there? 

    I have already tried to set one output directory for each projects in the solution, set the references property CopyLocal to False, but it doesn't work for me as expected. I also upgraded my machine with ssd and adittional ram, but it also not a solution in my case.

    Sorry for my English, its not my native language.
    Friday, September 9, 2016 6:07 AM

Answers

  • Thank you for your answer, Bryce.

    It doesn't look like Windows Runtime component helps a lot with build time optimization. In fact my wrapper is based on WinRT component, but still i have really bad building perfomance.

    I've tried to pack my lib in a nuget package, but I failed cause there are so many references of the target c++ lib to be included in this pack.

    Does somebody have an experience working with WinRT component nuget packages? Does it have a better perfomance than pure component?

    • Marked as answer by Jayden Gu Wednesday, October 12, 2016 10:02 AM
    Monday, September 12, 2016 9:40 AM
  • Thank you for your answer

    The key was to disable native toolchain in the project build properties.

    It reduces compilation time from 180 seconds to 15.

    God bless Native toolchain!!

    • Proposed as answer by Jayden Gu Wednesday, September 14, 2016 8:53 AM
    • Marked as answer by Alex Krafts Sunday, September 18, 2016 9:40 AM
    Tuesday, September 13, 2016 11:50 AM

All replies

  • use Windows Runtime Component to optimize your compiling time, or simply use another computer with better cpu
    Friday, September 9, 2016 6:15 AM
  • Thank you for your answer, Bryce.

    It doesn't look like Windows Runtime component helps a lot with build time optimization. In fact my wrapper is based on WinRT component, but still i have really bad building perfomance.

    I've tried to pack my lib in a nuget package, but I failed cause there are so many references of the target c++ lib to be included in this pack.

    Does somebody have an experience working with WinRT component nuget packages? Does it have a better perfomance than pure component?

    • Marked as answer by Jayden Gu Wednesday, October 12, 2016 10:02 AM
    Monday, September 12, 2016 9:40 AM
  • This happens because C++ uses static compilation. When you compile C++, the compiler has to do massive optimizations, linking, code generation etc, which take time.

    http://stackoverflow.com/questions/318398/why-does-c-compilation-take-so-long

    • Proposed as answer by Jayden Gu Tuesday, September 13, 2016 11:37 AM
    Monday, September 12, 2016 10:18 AM
  • Thank you for your answer

    The key was to disable native toolchain in the project build properties.

    It reduces compilation time from 180 seconds to 15.

    God bless Native toolchain!!

    • Proposed as answer by Jayden Gu Wednesday, September 14, 2016 8:53 AM
    • Marked as answer by Alex Krafts Sunday, September 18, 2016 9:40 AM
    Tuesday, September 13, 2016 11:50 AM
  • Hi Alex Krafts,

    Good Job, it is very kind of you to share the solution in here, it will help others who meet the same questions as you. 
    If you have any others question, welcome to post it in this forum.


    Best Regards,

    Jayden Gu

    Wednesday, September 14, 2016 8:55 AM