Build pipeline basics in Azure - Time & Space Complexity
When we run a build pipeline in Azure, it performs a series of steps to prepare our code. Understanding how the time it takes grows as we add more tasks helps us plan better.
We want to know: How does the total work increase when the pipeline has more steps?
Analyze the time complexity of the following Azure pipeline YAML snippet.
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
steps:
- script: echo "Step 1"
- script: echo "Step 2"
- script: echo "Step 3"
- script: echo "Step 4"
- script: echo "Step 5"
This pipeline runs five script steps one after another on a virtual machine.
Look at the steps that repeat in the pipeline.
- Primary operation: Each script step runs a command.
- How many times: Once per step, here 5 times.
As we add more steps, the total time grows with the number of steps.
| Input Size (n) | Approx. Operations |
|---|---|
| 10 steps | 10 script runs |
| 100 steps | 100 script runs |
| 1000 steps | 1000 script runs |
Pattern observation: The total work grows directly with the number of steps added.
Time Complexity: O(n)
This means if you double the number of steps, the total time roughly doubles too.
[X] Wrong: "Adding more steps won't affect total time much because they run fast."
[OK] Correct: Even if each step is quick, more steps add up and increase total time linearly.
Understanding how pipeline steps add up helps you design efficient builds and shows you can think about scaling work in real projects.
"What if we run some steps in parallel instead of one after another? How would the time complexity change?"