Azure Pipelines overview - Time & Space Complexity
When using Azure Pipelines, it's important to understand how the time to complete builds and deployments grows as you add more tasks or stages.
We want to know how the number of pipeline steps affects the total execution time.
Analyze the time complexity of a pipeline with multiple sequential tasks.
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
steps:
- script: echo Build Step 1
- script: echo Build Step 2
- script: echo Build Step 3
This pipeline runs three tasks one after another on a virtual machine.
Look at what repeats as we add more tasks.
- Primary operation: Running each script task sequentially on the build agent.
- How many times: Once per task added to the pipeline.
Each new task adds more work that runs one after another.
| Input Size (n) | Approx. API Calls/Operations |
|---|---|
| 10 | 10 tasks run sequentially |
| 100 | 100 tasks run sequentially |
| 1000 | 1000 tasks run sequentially |
Pattern observation: The total execution time grows directly with the number of tasks.
Time Complexity: O(n)
This means if you double the number of tasks, the total time roughly doubles too.
[X] Wrong: "Adding more tasks won't affect total time much because they run fast."
[OK] Correct: Even if each task is quick, running many tasks one after another adds up and increases total time linearly.
Understanding how pipeline steps add up helps you design efficient build and deployment processes, a useful skill in cloud roles.
"What if we ran some tasks in parallel instead of sequentially? How would the time complexity change?"