mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Perf: Use vector to replace list for object cache
This commit is contained in:
parent
471cf611c6
commit
50e331ff28
1 changed files with 3 additions and 2 deletions
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
class SrsRtpPacket2;
|
class SrsRtpPacket2;
|
||||||
|
|
||||||
|
@ -360,7 +361,7 @@ class SrsRtpObjectCacheManager
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bool enabled_;
|
bool enabled_;
|
||||||
std::list<T*> cache_objs_;
|
std::vector<T*> cache_objs_;
|
||||||
size_t capacity_;
|
size_t capacity_;
|
||||||
size_t object_size_;
|
size_t object_size_;
|
||||||
public:
|
public:
|
||||||
|
@ -370,7 +371,7 @@ public:
|
||||||
object_size_ = size_of_object;
|
object_size_ = size_of_object;
|
||||||
}
|
}
|
||||||
virtual ~SrsRtpObjectCacheManager() {
|
virtual ~SrsRtpObjectCacheManager() {
|
||||||
typedef typename std::list<T*>::iterator iterator;
|
typedef typename std::vector<T*>::iterator iterator;
|
||||||
for (iterator it = cache_objs_.begin(); it != cache_objs_.end(); ++it) {
|
for (iterator it = cache_objs_.begin(); it != cache_objs_.end(); ++it) {
|
||||||
T* obj = *it;
|
T* obj = *it;
|
||||||
srs_freep(obj);
|
srs_freep(obj);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue