Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!bcyclone04.am1.xlned.com!bcyclone04.am1.xlned.com!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'received:209.85.223': 0.03; 'encoding': 0.05; 'though:': 0.07; '"my': 0.09; 'bits': 0.09; 'way:': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'algorithm.': 0.16; 'codec': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'it;': 0.16; 'offense,': 0.16; 'readable': 0.16; 'subject:python': 0.16; '(you': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'feb': 0.22; 'cc:addr:python.org': 0.22; 'load': 0.23; 'byte': 0.24; 'integer': 0.24; 'processor': 0.24; "shouldn't": 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'towards': 0.31; 'subject:skip:i 10': 0.31; 'text': 0.33; 'sense': 0.34; 'received:209.85': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'two': 0.37; 'received:209': 0.37; 'subject:new': 0.38; 'needed': 0.38; 'whatever': 0.38; 'pm,': 0.38; 'how': 0.40; 'easy': 0.60; 'numbers': 0.61; 'simply': 0.61; 'first': 0.61; 'back': 0.62; 'places': 0.64; 'more': 0.64; 'believe': 0.68; 'theoretical': 0.74; '2015': 0.84; 'algorithm,': 0.84; 'beat:': 0.84; 'to:none': 0.92; 'average': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type:content-transfer-encoding; bh=AlTNpRQqJ2e7W/DvuOyNxVw9BcgHP6IyIIDOlf3bYWg=; b=RSSrOv8n0M+C/Q4T9q9uRJpfU5wZAnxWMUbTsJ2usLv5x5zxc3hywSu3YRZPFiS/WK oMnCF9Ht7zyhYW9HDxgEI6QBBjHK/weyiZHe76wwdruTmuJDYbJ3WYlYoRL9ZFF9DDQZ VVqg5ZkNEVrLkVfnZgUGLqapzLaJKQG5U4G30maKZxImXy86My9Y9/GbU6+lg5WlE+rB oQBpmkAa4BnwkR7tc8+evTYKxSnNHuLpzTDny25POdZ1y/xDvgMGQIbIPTVhJufUrD/u GW7HUL/njTcWol+MI1UBsFHxHgINdwJu9/Z+m9dYun/kXLW25WXWvmN/ayYgZiQMl0A0 t+sQ== MIME-Version: 1.0 X-Received: by 10.50.114.4 with SMTP id jc4mr1781828igb.14.1424252170926; Wed, 18 Feb 2015 01:36:10 -0800 (PST) In-Reply-To: <85554c47-0957-4a5a-8ac7-513cd0f436ff@googlegroups.com> References: <85554c47-0957-4a5a-8ac7-513cd0f436ff@googlegroups.com> Date: Wed, 18 Feb 2015 20:36:10 +1100 Subject: Re: python implementation of a new integer encoding algorithm. From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1424252180 news.xs4all.nl 2895 [2001:888:2000:d::a6]:48064 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 4914 X-Received-Body-CRC: 3984632803 Xref: csiph.com comp.lang.python:85780 On Wed, Feb 18, 2015 at 7:55 PM, wrote: >> Take the >> easy option; you can always make things more complicated later. > That makes sense alright. > No offense, but I still believe that human readable text encoding complic= ates things right now and shouldn't be tried until "my way" has proven unpr= actical in its first application. > Consider it to be a theoretical challenge: how do I find the general enco= ding of an arbitrary integer value that minimizes the number of bits needed= and given that algorithm, find the python code that minimizes the processo= r load inflicted by the codec implementation. > I would actually look at it the other way: a human-readable encoding is the easy way (you can simply print() your numbers and int() them on the way back in), and until you can prove that it's impractical, don't write a single line of code towards this algorithm. But let's get some figures, though: How many payload bits per byte can you achieve? What's your average going to be? You have two baselines to beat: 4 bits per byte (hexadecimal), and 7 bits per byte (MIDI varlen, or whatever you want to call it; I first met it with MIDI, but it's been used in so many places that other people have other names for it). ChrisA