|
| From: | Stefan Brüns |
| Subject: | Re: [Discuss-gnuradio] Small cleanups for inband code |
| Date: | Fri, 30 Jan 2009 18:35:29 +0100 |
| User-agent: | KMail/1.9.9 |
Here is another series of patches. These come in 3 flavours:
Independent, general cleanups and additions, which neither influence API nor
ABI
c1255: Minor optimization, assume well formed list as common case
c1256: Avoid some double type casting
c1261: Add some unit test for pmt_subsetp and pmt_memq
Changes in ABI, changing no functionality
c1257: Make function arguments const& (incomplete)
c1260: Make function arguments const& (continued)
Intrusive changes (pun intended)
c1258: Switch from shared_ptr to intrusive_ptr for pmt_t
Some more comments:
Patches in the first group should need no further discussion, as these are
just some optimizations which are completely invisible (despite speedup) from
the outside.
The second group should be unproblematic as well. Although a recompile of
anything dependent on pmt is needed, behaviour is unchanged.
The third one may need some more comments:
currently (trunk) pmt_t is defined as boost::shared_ptr<pmt_base>. Although
the refcounting is quite nice, it comes at a quite high cost. Every shared
pointer is combined from 3 objects, one being the "data" (in this case,
pmt_base), one the object for the refcounting, and the third one the
shared_ptr itself, holding pointers to two aforementioned objects. The last
one may be created on the stack, but the other two are allocated on the heap.
This costs are cut by half if using intrusive_ptr's. The refcount is stored in
the object itself. Some more speed is gained by the fact that some operations
are just simpler for intrusive_ptr than for shared_ptr (have a look at eg
operator= ....). Although the gain is high, there are no code changes needed,
just a simple recompile
All patches have been tested by running the mblock and pmt qa tests.
---
Benchmarks:
P4 HT @ 2.80GHz
test_usrp_inband_tx with a constant value for the signal generator:
Results of running "time ./test_usrp_inband_tx" (trunk)
real 0m20.670s
user 0m7.348s
sys 0m2.328s
Results of running "time ./test_usrp_inband_tx" (all patches applied)
real 0m20.574s
user 0m3.632s
sys 0m1.992s
---
Regards,
Stefan
PS: Not finished yet. Next is switching pmt_list* from pairs to vectors and
mb_message to intrusive_ptr as well. Also nice to have: lockless
implementation of the message queue ...
--
Stefan Brüns / Bergstraße 21 / 52062 Aachen
mailto:lurch at gmx.li http://www.kawo1.rwth-aachen.de/~lurchi/
phone: +49 241 53809034 mobile: +49 151 50412019
c1255.diff
Description: Text Data
c1260.diff
Description: Text Data
c1261.diff
Description: Text Data
c1256.diff
Description: Text Data
c1257.diff
Description: Text Data
c1258.diff
Description: Text Data
| [Prev in Thread] | Current Thread | [Next in Thread] |