A/B testing landing pages in Digital Marketing - Time & Space Complexity
When running A/B tests on landing pages, it's important to understand how the time to get results grows as you increase the number of visitors or variations.
We want to know how the testing process scales with more data and options.
Analyze the time complexity of this simplified A/B testing process.
for each visitor in visitors:
assign visitor to a landing page variant
record visitor action (click or no click)
calculate conversion rate for each variant
compare conversion rates to find the best
This code assigns visitors to different landing page versions, tracks their actions, and then compares results.
Look for repeated steps that take most time.
- Primary operation: Looping through each visitor to assign and record actions.
- How many times: Once for every visitor, so the number of visitors (n).
As the number of visitors grows, the time to process them grows too.
| Input Size (n) | Approx. Operations |
|---|---|
| 10 | About 10 assignments and recordings |
| 100 | About 100 assignments and recordings |
| 1000 | About 1000 assignments and recordings |
Pattern observation: The work grows directly with the number of visitors.
Time Complexity: O(n)
This means the time to complete the test grows in a straight line as more visitors participate.
[X] Wrong: "Adding more landing page variants will multiply the time by the number of variants squared."
[OK] Correct: Each visitor is assigned to only one variant, so time grows mainly with visitors, not variants squared.
Understanding how testing scales helps you design experiments that finish in reasonable time and handle more visitors smoothly.
"What if we tracked multiple actions per visitor instead of just one? How would the time complexity change?"