mirror of
https://github.com/yuzu-emu/yuzu-android
synced 2025-08-09 08:42:32 -07:00
Remove memory allocations in some hot paths
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <vector>
|
||||
#include <boost/container/small_vector.hpp>
|
||||
|
||||
#include "common/alignment.h"
|
||||
#include "common/assert.h"
|
||||
@@ -167,7 +168,7 @@ public:
|
||||
private:
|
||||
template <typename T>
|
||||
requires(std::is_trivially_copyable_v<T>)
|
||||
void WriteImpl(const T& val, std::vector<u8>& buffer) {
|
||||
void WriteImpl(const T& val, boost::container::small_vector<u8, 0x200>& buffer) {
|
||||
const size_t aligned_size = Common::AlignUp(sizeof(T), 4);
|
||||
const size_t old_size = buffer.size();
|
||||
buffer.resize(old_size + aligned_size);
|
||||
@@ -176,8 +177,8 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<u8> m_data_buffer;
|
||||
std::vector<u8> m_object_buffer;
|
||||
boost::container::small_vector<u8, 0x200> m_data_buffer;
|
||||
boost::container::small_vector<u8, 0x200> m_object_buffer;
|
||||
};
|
||||
|
||||
} // namespace Service::android
|
||||
|
Reference in New Issue
Block a user