From 97f0d1cecf4a8cb82e8e16e4dfcac0589c5b56c7 Mon Sep 17 00:00:00 2001 From: Marcus Müller <mueller@kit.edu> Date: Tue, 20 Feb 2018 11:22:14 +0100 Subject: blocks: remove unnecessary call to pmt::intern at runtime MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit typical usage: message_port_pub(pmt::mp("out_port"), …) which is bad, as it implies hashing of a string, allocation of memory, deallocation, finding the hashed string in the table of interned strings and returning a unique pointer (which for reasons of PMT awesomeness isn't even unique) to the interned port name. Replacing all these port name ad hoc ::mp() calls by reusing one, private, port name member. --- gr-blocks/lib/message_strobe_random_impl.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gr-blocks/lib/message_strobe_random_impl.h') diff --git a/gr-blocks/lib/message_strobe_random_impl.h b/gr-blocks/lib/message_strobe_random_impl.h index 2dcaa7effa..67e0e490c1 100644 --- a/gr-blocks/lib/message_strobe_random_impl.h +++ b/gr-blocks/lib/message_strobe_random_impl.h @@ -50,6 +50,8 @@ namespace gr { boost::shared_ptr< boost::variate_generator <boost::mt19937, boost::normal_distribution<> > > d_variate_normal; boost::shared_ptr< boost::variate_generator <boost::mt19937, boost::uniform_real<> > > d_variate_uniform; + const pmt::pmt_t d_port; + void update_dist(); public: -- cgit v1.2.3