-
Notifications
You must be signed in to change notification settings - Fork 109
chore: add performance tests (requires env key) #623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds comprehensive performance testing infrastructure for the Deepgram SDK with a focus on TTS operations, comparing SDK performance against raw HTTP requests and addressing telemetry performance concerns by moving event emission to background threads.
- Adds performance test framework with streaming and non-streaming TTS tests
- Implements background threading for telemetry event emission to prevent blocking critical operations
- Provides benchmarking utilities to measure TTFB and TTLB metrics
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/performance/init.py | Package initialization for performance test module |
| tests/performance/conftest.py | Test configuration with API key fixtures and test text generation |
| tests/performance/test_tts_performance_generate.py | Performance tests for non-streaming TTS operations comparing SDK vs raw httpx |
| tests/performance/test_tts_performance_stream.py | Performance tests for streaming TTS operations with detailed metrics |
| src/deepgram/extensions/core/instrumented_http.py | Updates HTTP instrumentation to emit telemetry events in background threads |
| src/deepgram/extensions/core/instrumented_socket.py | Updates WebSocket instrumentation to emit telemetry events in background threads |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| try: | ||
| with client.speak.v1.audio.with_raw_response.generate( | ||
| text=text, request_options={"chunk_size": chunk_size} |
Copilot
AI
Nov 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'chunk_size' parameter is passed in request_options but may not be a valid parameter for the SDK's generate method. This could lead to the parameter being silently ignored.
| # We capture minimal sync data here and defer detailed processing | ||
| if self._events is not None: | ||
| try: | ||
| import threading |
Copilot
AI
Nov 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Threading module is imported inside the function on every request. Consider importing at the module level to avoid repeated import overhead.
| # Emit connect event in background after connection is established | ||
| if events: | ||
| try: | ||
| import threading |
Copilot
AI
Nov 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Threading module is imported inside the function on every connection. Consider importing at the module level to avoid repeated import overhead.
Adds comprehensive performance testing infrastructure for the Deepgram SDK with a focus on TTS operations, comparing SDK performance against raw HTTP requests and addressing telemetry performance concerns by moving event emission to background threads.