summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib/buffer.cc
diff options
context:
space:
mode:
authorBrandon P. Enochs <brandon.enochs@nrl.navy.mil>2017-07-14 15:53:32 -0400
committerBrandon P. Enochs <brandon.enochs@nrl.navy.mil>2017-07-14 15:53:32 -0400
commitbb00e5eb2576a7e57ab6211dd40bcd11a6d3967f (patch)
treea5d690ae791e0a13fc31a1ccd114947fe852e314 /gnuradio-runtime/lib/buffer.cc
parent11f9915a1adb133813a1b959f24dda547a977001 (diff)
fix: fixed a performance bug in buffer::get_tags_in_range.
buffer::get_tags_in_range called v.resize(0) instead of v.clear() to clear out the input vector. This causes needless memory allocation of the default value for the second argument to resize. In applications that make heavy use of tags, this can cause significant performance problems as get_tags_in_range performs an extra allocation and deallocation.
Diffstat (limited to 'gnuradio-runtime/lib/buffer.cc')
-rw-r--r--gnuradio-runtime/lib/buffer.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/gnuradio-runtime/lib/buffer.cc b/gnuradio-runtime/lib/buffer.cc
index b706408412..db554d21e7 100644
--- a/gnuradio-runtime/lib/buffer.cc
+++ b/gnuradio-runtime/lib/buffer.cc
@@ -346,7 +346,7 @@ namespace gr {
{
gr::thread::scoped_lock guard(*mutex());
- v.resize(0);
+ v.clear();
std::multimap<uint64_t,tag_t>::iterator itr = d_buffer->get_tags_lower_bound(std::min(abs_start, abs_start - d_attr_delay));
std::multimap<uint64_t,tag_t>::iterator itr_end = d_buffer->get_tags_upper_bound(std::min(abs_end, abs_end - d_attr_delay));