diff options
| author | 2017-09-25 13:06:42 -0500 | |
|---|---|---|
| committer | 2017-09-25 18:31:37 -0500 | |
| commit | d7459354f58d1b71fc0c5ec48de9242e6a2fd00c (patch) | |
| tree | 20aa98adee17b0a2886273806a62f333d1198ab4 /src/audio_core/codec.h | |
| parent | Merge pull request #2952 from MerryMage/page-tables (diff) | |
| download | yuzu-d7459354f58d1b71fc0c5ec48de9242e6a2fd00c.tar.gz yuzu-d7459354f58d1b71fc0c5ec48de9242e6a2fd00c.tar.xz yuzu-d7459354f58d1b71fc0c5ec48de9242e6a2fd00c.zip | |
Audio: Use std::deque instead of std::vector for the audio buffer type (StereoBuffer16).
The current code inserts and deletes elements from the beginning of the audio buffer, which is very inefficient in an std::vector.
Profiling was done using VisualStudio2017's Performance Analyzer in Super Mario 3D Land.
Before this change: AudioInterp::Linear had 14.14% of the runtime (inclusive) and most of that time was spent in std::vector's insert implementation.
After this change: AudioInterp::Linear has 0.36% of the runtime (inclusive)
Diffstat (limited to 'src/audio_core/codec.h')
| -rw-r--r-- | src/audio_core/codec.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/audio_core/codec.h b/src/audio_core/codec.h index 2b0c395e6..877b2202d 100644 --- a/src/audio_core/codec.h +++ b/src/audio_core/codec.h | |||
| @@ -5,13 +5,13 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <vector> | 8 | #include <deque> |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | 10 | ||
| 11 | namespace Codec { | 11 | namespace Codec { |
| 12 | 12 | ||
| 13 | /// A variable length buffer of signed PCM16 stereo samples. | 13 | /// A variable length buffer of signed PCM16 stereo samples. |
| 14 | using StereoBuffer16 = std::vector<std::array<s16, 2>>; | 14 | using StereoBuffer16 = std::deque<std::array<s16, 2>>; |
| 15 | 15 | ||
| 16 | /// See: Codec::DecodeADPCM | 16 | /// See: Codec::DecodeADPCM |
| 17 | struct ADPCMState { | 17 | struct ADPCMState { |