Multi-process Unity Builds on M1 Pro Mac Show No Efficiency Gain Compared to Sequential Builds

I’m encountering an issue where parallelizing Unity APK builds across multiple processes does not reduce total build time on an Apple M1 Pro Mac. Here are the details:

Environment
Hardware: MacBook Pro with M1 Pro chip (8-core CPU: 6 performance cores + 2 efficiency cores), 32GB RAM, 1TB SSD.
Software: Unity 2021.3.41f1; Python 3.9.6 for process orchestration.

Observation
Sequential builds: Building 3 Unity projects one after another takes ~4 minutes per project, totaling ~12 minutes.

Parallel builds: Using Python’s multiprocessing module to spawn 3 processes (one per project) also takes ~12 minutes total.

Process Implementation (Python snippet):**

import multiprocessing
import subprocess

def build_project(project_path):
    """
    Builds a Unity project using command-line arguments.
    
    Args:
        project_path (str): Path to the Unity project directory.
    """
    try:
        # Define the Unity build command
        command = [
            "Unity",  # Unity executable (ensure it's in your PATH)
            "-quit",  # Exit Unity after the build
            "-batchmode",  # Run in headless mode
            "-projectPath", project_path,  # Path to the Unity project
            "-executeMethod", "BuildScript.BuildAndroid"  # Custom build method
        ]
        
        # Execute the command
        print(f"Starting build for project: {project_path}")
        os.system(command)
        print(f"Build completed for project: {project_path}")
    except subprocess.CalledProcessError as e:
        print(f"Build failed for project {project_path}: {e}")

if __name__ == '__main__':
    # List of Unity project paths
    projects = [
        "/path/to/Project1",  # Replace with actual path
        "/path/to/Project2",  # Replace with actual path
        "/path/to/Project3"   # Replace with actual path
    ]

    # Create a list to hold process objects
    processes = []

    # Start a process for each project
    for project in projects:
        process = multiprocessing.Process(target=build_project, args=(project,))
        process.start()
        processes.append(process)

    # Wait for all processes to complete
    for process in processes:
        process.join()

    print("All builds completed.")

Troubleshooting Attempts :
Verified no output path conflicts (each project writes to a separate directory).
Checked Unity Editor.log for errors – no apparent locks or failures.
Tested with 2 parallel processes instead of 3 – total time still ~8 minutes (close to 4x2).
SSD disk I/O appears healthy

Key Questions:
Why might parallel Unity builds on Apple Silicon not leverage multi-core efficiency as expected?

When I tested on an M4 Mac device, the results were the same. Compiling two independent Unity projects sequentially and compiling them simultaneously using multiprocess both took around 4 * 2 = 8 minutes. So I suspect that Unity might not actually support multiprocess compilation, possibly due to resource locking or similar issues. You guys can also test this on your own computers to reproduce the issue. I hope we can get a professional explanation for this."Feel free to adjust the wording if needed!

Hey,

It’s difficult to say without full captures but whereas certain parts of the build pipeline are serial, a lot of aspects of the pipeline (texture compression, shader compilation etc.) already go wide and utilize multiple cores, so you may already be seeing high-multi-core utilization with the 4 minute build-time.