cisco / ChezScheme

Chez Scheme
Apache License 2.0
6.89k stars 983 forks source link

Building is now very slow? #791

Closed mml closed 6 months ago

mml commented 6 months ago

From v9 to v10. I have an "older" hexa-core system with 2 hyperthreads per core, and I thought the slowdown might be due to decreased parallelism when using zuo. But they both end up using about 1.6 cores. The newer build just does 7x more work?

% git branch
* (HEAD detached at v9.6.4)   main                       
% make distclean
[...]
% ./configure --installprefix=/opt/chez9
[...]
% command time -v make -j12
[...]
        User time (seconds): 42.21
        System time (seconds): 3.56
        Percent of CPU this job got: 162%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 0:28.16
[...]
% ./configure --prefix=/opt/chez10       
Configuring for ta6le, and will create boot files via pb
% make clean
mkdir -p bin
gcc -m64 -msse2 -O2 -DZUO_LIB_PATH='"'"../zuo/lib"'"' -o bin/zuo ./zuo/zuo.c
bin/zuo ta6le clean MAKE="make"
rm -f bin/zuo
% command time -v make -j12
[...]
        User time (seconds): 289.29
        System time (seconds): 6.02
        Percent of CPU this job got: 163%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 3:01.10
[...]
jltaylor-us commented 6 months ago

Configuring for ta6le, and will create boot files via pb

As described in the release notes, the initial build is bootstrapped using a platform-independent "portable boot" virtual machine architecture. This is obviously going to be slower than native code.

mml commented 6 months ago

@jltaylor-us thanks for that pointer. I tried using the re.boot makefile target to speed things up, expecting this would create native bootfiles and let me avoid using the VM. It creates files in boot/ta6le, but then when I run a straight make after that, it still says it's building boot files for ta6le using pb.

% command time -v make -j12 re.boot
[...]
        User time (seconds): 135.22
        System time (seconds): 1.70
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 2:16.96
[...]
% command time -v make -j12
bin/zuo ta6le MAKE="make"
checking boot files for ta6le against pb
pb/bin/pb/scheme is up to date
pb/bin/pb/petite is up to date
building boot files for ta6le using pb
running pb/bin/pb/scheme to build xc-ta6le/s/cmacros.so
[...]
jltaylor-us commented 6 months ago

That still seems like a long time to make the re.boot target... is it actually using your existing scheme installation? The instructions in BUILDING mention a --force flag; maybe that would help?

Setting that aside, you're also saying that even after it's built some boot files it doesn't "pick them up" for the next build? I'm not sure what precise workflow you're trying to implement, but it seems like that should be supported. I haven't tried to do anything other than the simplest make targets since the build system was updated to default to the pb machine type, so we might have to tag in @mflatt to tell us what's going wrong here.

mml commented 6 months ago

Ah, OK. When using ./configure --force, things work as expected. Building the boot files still takes >2 minutes, but after that, the build time is much more in keeping with the Chez 9 builds.

% command time -v make -j12
[...]
        User time (seconds): 68.26
        System time (seconds): 3.89
        Percent of CPU this job got: 180%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 0:39.86
[...]
mflatt commented 6 months ago

Although ./configure --force is the way I normally work with make re.boot, I agree that tracking should be more automatic. I think it's just a matter of properly recording make re.boot in build.zuo, and I'll work on that.

mml commented 6 months ago

Thanks for the extremely quick response.