python implementation of a new integer encoding algorithm.

Denis McMahon denismfmcmahon at gmail.com
Thu Feb 19 21:46:25 EST 2015


On Tue, 17 Feb 2015 03:22:47 -0800, janhein.vanderburg wrote:

> In http://optarbvalintenc.blogspot.nl/ I propose a new way to encode
> arbitrarily valued integers

I'm not quite sure I understand the problem that you're trying to solve 
with this.

If I want to transmit some arbitrarily huge integer value between two 
systems there are several ways to do it:

Numeric text - roughly 24 bits are used to carry 10 bits of value

Alphanumeric text - 8 bits are used to carry every 4 bits of value

A bit sequence of length n bits where 2^n > the value I wish to convey, 
providing that there is some mechanism by which the sender can tell the 
receiver "the next n bits represent a binary integer." It might be 
desirable to pad the bit stream to a byte boundary. Assuming an 8 bit 
clean transmission path and a maximum padding of 7 bits, this is 
increasingly efficient as the integer being transmitted gets larger.

The thing is, for all practical purposes, any integer that is capable of 
being processed as an integer by a computer is probably already being 
stored in a binary format in a storage space of n bytes, where n is a 
power of 2. Very little additional processing should be needed to 
packetize those n bytes and transmit them.

Additionally, you're talking about efficiency and the need to optimise, 
but you're using a scripted language. If you need a highly efficient 
protocol to transfer binary numbers between two systems with minimum 
wasted bits and maximum cpu and memory efficiency, python really isn't 
the language in which to solve your problem.

Perhaps it's time to take a step back and redefine the problem a bit more 
clearly, because at the moment I'm not sure you're solution will ever 
solve anything that needs solving.

-- 
Denis McMahon, denismfmcmahon at gmail.com



More information about the Python-list mailing list