diff --git a/tests/experimental/openapi_parser/server/openapi/test_performance_comparison.py b/tests/experimental/openapi_parser/server/openapi/test_performance_comparison.py index 99ee4f886..f36eeb1a8 100644 --- a/tests/experimental/openapi_parser/server/openapi/test_performance_comparison.py +++ b/tests/experimental/openapi_parser/server/openapi/test_performance_comparison.py @@ -214,9 +214,21 @@ class TestPerformanceComparison: ) # Performance should be comparable (within reasonable margin) - performance_ratio = max(new_avg, legacy_avg) / min(new_avg, legacy_avg) - assert performance_ratio < 3.0, ( - f"Performance should be comparable, ratio: {performance_ratio:.2f}x" + # Split checks to identify which implementation is faster/slower + faster_time = min(new_avg, legacy_avg) + slower_time = max(new_avg, legacy_avg) + performance_ratio = slower_time / faster_time + + # First check: identify which is faster + if new_avg < legacy_avg: + print(f"New implementation is faster by {performance_ratio:.2f}x") + else: + print(f"Legacy implementation is faster by {performance_ratio:.2f}x") + + # Second check: ensure performance is comparable (within 4x) + assert performance_ratio < 4.0, ( + f"Performance should be comparable, ratio: {performance_ratio:.2f}x " + f"({'new' if new_avg > legacy_avg else 'legacy'} is slower)" ) def test_functionality_identical_after_optimization(self, comprehensive_spec):