Speed up build on Windows by generating symbol definition in batch

From: Peifeng Qiu <pqiu(at)pivotal(dot)io>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Speed up build on Windows by generating symbol definition in batch
Date: 2019-03-30 06:42:39
Message-ID: CABmtVJiKXQjast0dQD-8KAtfm8XmyYxo-4Dc7+M+fBr8JRTqkw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, hackers.

Build process on Windows includes compiling all source into object files,
linking them to binaries, and generating export symbol definitions, etc.
When I watched the whole build process with a task manager, I discovered
that a lot of time was spent on generating export symbol definitions,
without consuming much CPU or IO.
The script that doing this is src/tools/msvc/gendef.pl, it enumerates the
whole directory for ".obj" files and call dumpbin utility to generate
".sym" files one by one like this:

dumpbin /symbols /out:a.sym a.obj >NUL

Actually the dumpbin utility accepts a wildcard file name, so we can
generate the export symbols of all ".obj" files in batch.

dumpbin /symbols /out:all.sym *.obj >NUL

This will avoid wasting time by creating and destroying dumpbin process
repeatedly and can speed up the build process considerably.
I've tested on my 4-core 8-thread Intel i7 CPU. I've set MSBFLAGS=/m to
ensure it can utilize all CPU cores.
Building without this patch takes about 370 seconds. Building with this
patch takes about 200 seconds. That's almost 2x speed up.

Best regards,
Peifeng Qiu

Attachment Content-Type Size
generate-symbols-in-batch-on-windows-v1.patch application/octet-stream 1.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2019-03-30 07:33:36 RE: Timeout parameters
Previous Message Павлухин Иван 2019-03-30 06:35:39 Column lookup in a row performance