On Thu, Mar 17, 2016 at 03:43:36PM +0000, Sangamesh Sajjan wrote:
We are proposing following modification for above,
* Array of strings shall be used for 1's run length code word
* Array of strings shall be used for 0's run length code word
These two arrays will have code words of both terminating codes and make up codes
together.
In this approach two trees (i.e ones list and zero list) shall be introduced and entire
code word traversing shall be done in respective tree in single traversal.
With this approach we can avoid multiple array usage.
Hi Sangamesh,
though I'm not entirely familiar with the compression algorithm, I'm
pretty sure that using an array of strings to store bits will make the
code less efficient by magnitudes.
If I have bits in a primitive like an int, I can compare them to other
bits with a single CPU clock cycle. Even if they are shifted/fragmented to
a different bit position, using shl or shr (<< or >>) and comparing
int-wise will be extremely faster than iterating an array of chars of '1'
and '0' and interpreting those as 1 and 0.
I do see that it might make the code arrays easier to read and understand
for humans, but that wouldn't make up for the humungous performance loss
you're inflicting at the same time.
Please correct me if I'm missing something, but my guess is that you're on
the verge of an abyss here ;)
~Neels
--
- Neels Hofmeyr <nhofmeyr(a)sysmocom.de>
http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Alt-Moabit 93
* 10559 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschäftsführer / Managing Directors: Holger Freyther, Harald Welte