Skip to content

Conversation

@lukeocodes
Copy link
Contributor

@lukeocodes lukeocodes commented Nov 1, 2025

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

@lukeocodes lukeocodes requested a review from Copilot November 1, 2025 14:42
Copy link

Copilot AI left a 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}
Copy link

Copilot AI Nov 1, 2025

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.

Copilot uses AI. Check for mistakes.
# We capture minimal sync data here and defer detailed processing
if self._events is not None:
try:
import threading
Copy link

Copilot AI Nov 1, 2025

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.

Copilot uses AI. Check for mistakes.
# Emit connect event in background after connection is established
if events:
try:
import threading
Copy link

Copilot AI Nov 1, 2025

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.

Copilot uses AI. Check for mistakes.
@deepgram deepgram deleted a comment from coderabbitai bot Nov 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants