Skip to content

[zig cc] 3x+ slower ./configure times with zig cc, compared to clang/gcc #24318

@henderkes

Description

@henderkes

Zig Version

0.15-dev

Steps to Reproduce and Observed Behavior

Let me preface this by saying that I'm not entirely sure whether it is a bug, or a side effect of zig having to check for libc symbols every time anew. Maybe there is a way to first dump a precompiled sysroot for it and use that, to speed it up? I couldn't find any such information, unfortunately.

Preparation:

wget https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.tar.gz
tar -xzf pkg-config-0.29.tar.gz
cd pkg-config-0.29/

Time clang:

CC=clang /usr/bin/time -v ./configure --with-internal-glib --disable-host-tool --without-sysroot --without-system-include-path --without-system-library-path --without-pc-path --disable-shared --enable-static --prefix=/home/m/static-php-cli/buildroot --with-pic

->

        User time (seconds): 4.15
        System time (seconds): 1.88
        Percent of CPU this job got: 38%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 0:15.75
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 82500
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 4
        Minor (reclaiming a frame) page faults: 3244215
        Voluntary context switches: 105361
        Involuntary context switches: 98
        Swaps: 0
        File system inputs: 176
        File system outputs: 20904
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0

Time zig cc:

CC="zig cc" /usr/bin/time -v ./configure --with-internal-glib --disable-host-tool --without-sysroot --without-system-include-path --without-system-library-path --without-pc-path --disable-shared --enable-static --prefix=/home/m/static-php-cli/buildroot --with-pic

->

        User time (seconds): 7.44
        System time (seconds): 3.32
        Percent of CPU this job got: 20%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 0:52.72
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 67312
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 403
        Minor (reclaiming a frame) page faults: 4484282
        Voluntary context switches: 672005
        Involuntary context switches: 425
        Swaps: 0
        File system inputs: 6048
        File system outputs: 21584
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0

Expected Behavior

Identical logs and nearly identical times.

The logs are nearly identical, with the only difference being:

-checking for growing stack pointer... yes
+checking for growing stack pointer... no`

But the times are wildly different:

-User time (seconds): 4.15
-System time (seconds): 1.88
-Percent of CPU this job got: 38%
-Elapsed (wall clock) time (h:mm:ss or m:ss): 0:15.75
+User time (seconds): 7.44
+System time (seconds): 3.32
+Percent of CPU this job got: 20%
+Elapsed (wall clock) time (h:mm:ss or m:ss): 0:52.72

The percent of CPU this job got varies from 20-40% on both sides, but the times don't change in a meaningful way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions