From 64c19b368db4aea748467b5f763add99c7deb701 Mon Sep 17 00:00:00 2001 From: skal Date: Thu, 5 Feb 2026 19:49:27 +0100 Subject: perf: Reduce audio test durations for faster test suite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Optimized long-running audio tests to significantly improve test suite performance while maintaining test coverage. Changes: - WavDumpBackend: Added set_duration() method with configurable duration - Default remains 60s for debugging/production use - Test now uses 2s instead of 60s (140x faster: 60s → 0.43s) - JitteredAudioBackendTest: Reduced simulation durations - Test 1: 2.0s → 0.5s (4x faster) - Test 2: 10.0s → 3.0s (3.3x faster) - Overall: 14.49s → 4.48s (3.2x faster) - Updated assertions for shorter durations - Progress indicators adjusted for shorter tests Results: - Total test suite time: 18.31s → 8.29s (55% faster) - All 20 tests still pass - Tests still properly validate intended behavior handoff(Claude): Optimized audio test performance to speed up development iteration without sacrificing test coverage. WavDumpBackend now has configurable duration via set_duration() method. --- src/audio/wav_dump_backend.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/audio/wav_dump_backend.h') diff --git a/src/audio/wav_dump_backend.h b/src/audio/wav_dump_backend.h index b037fd1..eb6e011 100644 --- a/src/audio/wav_dump_backend.h +++ b/src/audio/wav_dump_backend.h @@ -26,8 +26,13 @@ class WavDumpBackend : public AudioBackend { // Set output filename (call before init()) void set_output_file(const char* filename); + // Set duration in seconds (default: 60s, call before start()) + void set_duration(float seconds); + // Get total samples written - size_t get_samples_written() const { return samples_written_; } + size_t get_samples_written() const { + return samples_written_; + } private: // Write WAV header with known sample count @@ -41,6 +46,7 @@ class WavDumpBackend : public AudioBackend { size_t samples_written_; const char* output_filename_; bool is_active_; + float duration_sec_; static const int kSampleRate = 32000; static const int kBufferSize = 1024; -- cgit v1.2.3