zyedidia / eget

Easily install prebuilt binaries from GitHub.
MIT License
954 stars 39 forks source link

Add concurrent builds #52

Closed patinthehat closed 1 year ago

patinthehat commented 1 year ago

Summary

This PR updates the tools/build-all.go utility to achieve significantly shorter overall build times on multi-core processors by using goroutines to allow concurrent builds.

Additionally, it updates the Makefile to send all outputs to the dist directory, keeping the generated files more organized. It also adds a build-dist task, which is now used by the package task to output the compiled binary with a unique name (which was necessary due to the concurrent build processes). The clean task was also updated accordingly.

Benchmarks:

Benchmarks were run on a system with the following specs:

processor model name    : 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
number of cpu cores : 8
actual + virtual cores  : 16

Benchmark TLDR

Benchmark Results

# concurrent builds
go run tools/build-all.go  27.36s user 7.27s system 1138% cpu 3.041 total
# sequential builds
go run tools/build-all.go  20.05s user 5.45s system 196% cpu 12.982 total