Skip to content

Conversation

@rajanyadav0307
Copy link

Issue #, if available:
N/A

Description of changes:

  • Optimized vector insertions in TextToSpeechManager.cpp by replacing push_back with emplace_back.
    1. In EnumerateDevices(), OutputDevicePair is now constructed directly in the vector memory instead of creating a temporary and pushing it.
    2. In ListAvailableVoices(), voice name/language pairs are now constructed directly in place, and the vector reserves capacity upfront to reduce reallocations.
  • These changes eliminate unnecessary temporaries, slightly improve performance, and adhere to modern C++ best practices.
  • No functional changes or API changes; fully backward-compatible.

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (Existing unit tests verify correctness; no new tests required.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR:

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

rajanyadav0307 and others added 2 commits December 16, 2025 20:19
- Replaced push_back with emplace_back in EnumerateDevices() to construct OutputDevicePair directly in the vector memory.
- Replaced push_back with emplace_back in ListAvailableVoices() and reserved vector capacity to avoid temporary pairs and multiple reallocations.

These changes improve performance by eliminating unnecessary temporary objects and adhere to modern C++ best practices.
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.

1 participant