Microsoft Visual C++ base building

After installing Microsoft Visual C++ on my Windows VM as required by pip to create the Python package for SWI-Prolog, I took some time to see whether I could build SWI-Prolog using MSVC. The current state for building is described at Building SWI-Prolog on MS-Windows. Summarizing the story

  • The core and most of the packages now build. Mostly required rewriting the atomic instructions to use MSVC intrinsics and a lot of refinement on types as MSVC is a lot pickier here than GCC and Clang.
  • Building is dramatically slow. That is because both the cmake configure process and the actual building start many short command line tasks and this is just slow on Windows. Parallel building doesn’t seem to help much, despite I gave the VM 16 cores and 64Gb memory. I don’t know why.
  • On my famous CHAT80 timing, GCC on Linux runs the benchmark in 0.68 sec. The MinGW (GCC for Windows) version runs on 0.8 sec. I don’t know why this is slower. A VM should not make a difference for a pure CPU bound task. The MSVC compiled version requires 1.05 seconds. Curiously, using the default giant switch for the VM loop, MSVC optimization barely helps and the time is over 2 seconds. Using @dmchurch work to run the VM as a set of functions, each implementing an instruction, the optimizer does its work, cutting the time in half.

I put this in the request for comments category to see whether people have ideas on the place we should give to this and to see whether there are ideas to streamline this further or make better use of it. We can use it to make Windows pip install SWI-Prolog. That was one of the ideas. Allowing to use the Visual Studio debugger might be nice for some people as well.

1 Like