Re: windows build slow due to windows.h includes

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: windows build slow due to windows.h includes
Date: 2021-09-21 20:13:55
Message-ID: 4eaa700c-1285-340e-1240-182f32de9255@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 9/21/21 3:30 PM, Andres Freund wrote:
> Hi,
>
> For the AIO stuff I needed to build postgres for windows. And I was a bit
> horrified by the long compile times. At first I was ready to blame the MS
> compiler for being slow, until I noticed that using mingw gcc from linux to
> cross compile to windows is also a *lot* slower than building for linux.
>
> I found some blog-post-documented-only compiler flags [1], most importantly
> /d1reportTime. Which shows that the include processing of postgres.h takes
> 0.6s [2]
>
> Basically all the time in a debug windows build is spent parsing windows.h and
> related headers. Argh.
>
> The amount of stuff we include in win32_port.h and declare is pretty absurd
> imo. There's really no need to expose the whole backend to all of it. Most of
> it should just be needed in a few port/ files and a few select users.
>
> But that's too much work for my taste. As it turns out there's a partial
> solution to windows.h being just so damn big, the delightfully named
> WIN32_LEAN_AND_MEAN.
>
> This reduces the non-incremental buildtime in my 8 core windows VM from 187s to
> 140s. Cross compiling from linux it's
> master:
> real 0m53.807s
> user 22m16.930s
> sys 2m50.264s
> WIN32_LEAN_AND_MEAN
> real 0m32.956s
> user 12m17.773s
> sys 1m52.313s

Nice!

I also see references to VC_EXTRALEAN which defines this and some other
stuff that might make things even faster.

Worth investigating.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2021-09-21 20:19:32 Re: Eval expression R/O once time (src/backend/executor/execExpr.c)
Previous Message Andrew Dunstan 2021-09-21 19:58:15 Re: Delegating superuser tasks to new security roles (Was: Granting control of SUSET gucs to non-superusers)