Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsfeed.datemas.de!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'encoding': 0.05; 'bytes,': 0.09; 'bytes.': 0.09; 'counting': 0.09; 'output,': 0.09; 'will,': 0.09; 'jan': 0.12; '384': 0.16; '386': 0.16; 'bits.': 0.16; 'integers,': 0.16; 'worse.': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'else,': 0.19; 'thu,': 0.19; 'seems': 0.21; 'feb': 0.22; 'bytes': 0.24; "haven't": 0.24; 'looks': 0.24; '---': 0.24; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'that.': 0.31; 'subject:skip:i 10': 0.31; 'raw': 0.33; 'could': 0.34; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'scheme': 0.36; 'subject:new': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'extremely': 0.39; 'to:addr:python.org': 0.39; 'dave': 0.60; 'length': 0.61; "you're": 0.61; 'between': 0.67; 'ranges': 0.74; '2015': 0.84; 'grew': 0.84; 'angel': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=fLBIbp66TKGHUQ4EyjXzalLZ9M3E6tyFssITIAoBlf4=; b=Q9W049dZPQtFkb/Cmn9EOEhPVC9S4y/0sJcS9KjIgyL/hse1WHHJni7Y+oWqSQ88E0 NztY8dc3FOhckTEy6P6TFkh49seCUrLDKTq2RiIaL6Uw6kUukwW2vXOfYYtCR4W9O4In gwQTxEbwmC3nw8LAVM3ikw+6Dl0szP3dWv0wursSr90P7yMPfiS1Pj0opn8jfnNsCodP QbTp/FMQqvpxZUofFZXDxRpo/WoIhxh6vw1cMd3pJgV6qmp3dEPI0RT/1gAbwFa9Ztto zGRWjHWDN1tgLzqJ1gVI0TiHPvkl5BOZ9Jrtl2byVhWfePfyp17LPuzpqHE9XHslJ+2i fWMA== X-Received: by 10.66.65.234 with SMTP id a10mr10321435pat.120.1424370778222; Thu, 19 Feb 2015 10:32:58 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <54E62A68.4010603@davea.name> References: <515047c1-a20d-430e-a029-1c2d77db2f1a@googlegroups.com> <2a717ffb-d61d-4407-9082-1c17cd7ee573@googlegroups.com> <993f64c3-fc85-48a7-9d02-a4f12ecb33c6@googlegroups.com> <54E62A68.4010603@davea.name> From: Ian Kelly Date: Thu, 19 Feb 2015 11:32:17 -0700 Subject: Re: python implementation of a new integer encoding algorithm. To: Python Content-Type: text/plain; charset=UTF-8 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: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1424371191 news.xs4all.nl 2921 [2001:888:2000:d::a6]:55701 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:85920 On Thu, Feb 19, 2015 at 11:24 AM, Dave Angel wrote: > Here's a couple of ranges of output, showing that the 7bit scheme does > better for values between 384 and 16379. > > 382 2 80fe --- 2 7e82 > 383 2 80ff --- 2 7f82 > 384 3 810000 --- 2 0083 > 384 jan grew 3 810000 > 385 3 810001 --- 2 0183 > 386 3 810002 --- 2 0283 > 387 3 810003 --- 2 0383 > 388 3 810004 --- 2 0483 > 389 3 810005 --- 2 0583 > > 16380 3 813e7c --- 2 7cff > 16380 jan grew 3 813e7c > 16380 7bit grew 2 7cff > 16381 3 813e7d --- 2 7dff > 16382 3 813e7e --- 2 7eff > 16383 3 813e7f --- 2 7fff > 16384 3 813e80 --- 3 000081 > 16384 7bit grew 3 000081 > 16385 3 813e81 --- 3 010081 > 16386 3 813e82 --- 3 020081 > 16387 3 813e83 --- 3 030081 > 16388 3 813e84 --- 3 040081 > 16389 3 813e85 --- 3 050081 > > In all my experimenting, I haven't found any values where the 7bit scheme > does worse. It seems likely that for extremely large integers, it will, but > if those are to be the intended distribution, the 7bit scheme could be > replaced by something else, like just encoding a length at the beginning, > and using raw bytes after that. It looks like you're counting whole bytes, not bits. That would be important since the "difficult" encoding uses fractional bytes.