Skip to content

Commit

Permalink
Perf: Use vector to replace list for object cache
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Feb 27, 2021
1 parent 471cf61 commit 50e331f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions trunk/src/kernel/srs_kernel_rtc_rtp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include <string>
#include <list>
#include <vector>

class SrsRtpPacket2;

Expand Down Expand Up @@ -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:
Expand All @@ -370,7 +371,7 @@ class SrsRtpObjectCacheManager
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);
Expand Down

0 comments on commit 50e331f

Please sign in to comment.