mainsail-crew / crowsnest

Webcam Service for multiple Cams
GNU General Public License v3.0
302 stars 71 forks source link

Feature request: Build with more Processor #255

Closed Neko-vecter closed 3 months ago

Neko-vecter commented 3 months ago

Is your feature request related to a problem? Please describe

If using a system that have more than 4 processor. The makefile will only use 4 processor.

When using CI for build images. Usually a server is used to do the build. Unlike a Single Board Computer (like a Raspberry Pi) a server have more cores that available. Using more CPU cores allows for faster system image builds.

Describe the solution you'd like

change build_apps() function in file bin/build.sh

    # check the system memory
    if [[ "$(get_avail_mem)" -le 524288 ]]; then
        USE_PROCS=-j1
    elif [[ "$(get_avail_mem)" -le 1048576 ]]; then
        USE_PROCS=-j2
    else
        # If there is enough memory using the max processor to build 
        # $(nproc) will use the max processor core the system have
        USE_PROCS=-j$(nproc) 
    fi

Describe alternatives you've considered

No response

Additional information

No response

mryel00 commented 3 months ago

As we don't know if this might have unseen consequences, for maybe our OS buildchain running on GitHub runners, or at some other point, we won't add such a thing. A Pi4 takes about 3m22s to build camera-streamer, so imo it isn't worth the risk to break something just to save ~1-2 minutes.

Also as a sidenote, we will change to prebuilt binaries as already mentioned in your other FR #218, therefore this code will be deprecated and removed with that other FR.

If you only talked about x86 systems and therefore only ustreamer, I can safely say, you won't get any benefit from increasing it. Pi4 takes 16s with 4 cores. My WSL takes 1.2s with 16 cores and 1.4s with 4 cores.