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
f2d9eb345c
commit
6656330d2a
1 changed files with 3 additions and 2 deletions
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
class SrsRtpPacket2;
|
||||
|
||||
|
@ -360,7 +361,7 @@ class SrsRtpObjectCacheManager
|
|||
{
|
||||
private:
|
||||
bool enabled_;
|
||||
std::list<T*> cache_objs_;
|
||||
std::vector<T*> cache_objs_;
|
||||
size_t capacity_;
|
||||
size_t object_size_;
|
||||
public:
|
||||
|
@ -370,7 +371,7 @@ public:
|
|||
object_size_ = size_of_object;
|
||||
}
|
||||
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) {
|
||||
T* obj = *it;
|
||||
srs_freep(obj);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue