File tree Expand file tree Collapse file tree
Lib/test/test_profiling/test_sampling_profiler Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -385,49 +385,15 @@ def cpu_intensive_work():
385385 result = result % 1000000
386386 return result
387387
388- def medium_computation():
389- """Medium complexity function."""
390- result = 0
391- for i in range(100):
392- result += i * i
393- return result
394-
395- def fast_loop():
396- """Fast simple loop."""
397- total = 0
398- for i in range(50):
399- total += i
400- return total
401-
402- def nested_calls():
403- """Test nested function calls."""
404- def level1():
405- def level2():
406- return medium_computation()
407- return level2()
408- return level1()
409-
410388def main_loop():
411- """Main test loop with different execution paths ."""
412- max_iterations = 1000
389+ """Main test loop."""
390+ max_iterations = 200
413391
414- iteration = 0
415-
416- while iteration < max_iterations:
417- iteration += 1
418-
419- # Different execution paths - focus on CPU intensive work
420- if iteration % 3 == 0:
421- # Very CPU intensive
422- result = cpu_intensive_work()
423- elif iteration % 5 == 0:
424- # Expensive recursive operation
425- result = slow_fibonacci(12)
392+ for iteration in range(max_iterations):
393+ if iteration % 2 == 0:
394+ result = slow_fibonacci(15)
426395 else:
427- # Medium operation
428- result = nested_calls()
429-
430- # No sleep - keep CPU busy
396+ result = cpu_intensive_work()
431397
432398if __name__ == "__main__":
433399 main_loop()
You can’t perform that action at this time.
0 commit comments