@@ -121,6 +121,32 @@ def test_stress_test_factory_pattern_windows(self):
121121 # Verify registry has cached logger
122122 assert "stress_cached_win" in get_registered_loggers ()
123123
124+ @pytest .mark .skipif (sys .platform != "win32" , reason = "Windows-specific tests" )
125+ def test_enum_vs_string_performance_windows (self ):
126+ """Test that enum usage doesn't significantly impact performance on Windows."""
127+ # Test with string values
128+ start_time = time .perf_counter ()
129+ for i in range (25 ):
130+ create_logger ("basic" , name = f"string_test_{ i } _win" , level = "INFO" )
131+ string_time = time .perf_counter () - start_time
132+
133+ # Test with enum values
134+ start_time = time .perf_counter ()
135+ for i in range (25 ):
136+ create_logger (LoggerType .BASIC , name = f"enum_test_{ i } _win" , level = LogLevel .INFO )
137+ enum_time = time .perf_counter () - start_time
138+
139+ # Handle Windows timing precision issues
140+ # If string_time is too small to measure accurately
141+ min_threshold = 0.001 # 1ms minimum threshold
142+ if string_time < min_threshold :
143+ # If timing is too precise, just ensure enum operations complete reasonably fast
144+ assert enum_time < 0.1 # Should complete within 100ms
145+ else :
146+ # Normal case: enum performance should be comparable to strings
147+ # Allow 60% tolerance for enum conversion overhead
148+ assert enum_time <= string_time * 1.6
149+
124150 @pytest .mark .skipif (sys .platform != "win32" , reason = "Windows-specific tests" )
125151 def test_windows_file_locking_resilience_performance (self ):
126152 """Test performance with Windows file locking scenarios."""
0 commit comments