From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id CE1E4941 for ; Fri, 31 Mar 2017 20:38:18 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-io0-f171.google.com (mail-io0-f171.google.com [209.85.223.171]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 26625140 for ; Fri, 31 Mar 2017 20:38:18 +0000 (UTC) Received: by mail-io0-f171.google.com with SMTP id l7so46789073ioe.3 for ; Fri, 31 Mar 2017 13:38:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bittorrent-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=iDmiQjbbs+ncOaSPZQyrQa9MO3yFcmcOHTqsF/1P1Eo=; b=SjW1v0/r4ZzN+1U3/OOiSiniMlSpTuPeO3vVoDCb+fUe6+W6ij5CaEjVQb5DMLwwMV yX8Hb7VYfwYanwU+07tZC88Ir5mvRiiuQ8KDhCZbfKublWWUc7CzJzXRQYoLeUQbu3mt ieVpfg3ElDmLCQihrjCW1dHUO6lXGifU34IHKXxACwytWVwCLEH/AEXffzrVBwqkEzfJ C1VcRYcrwRXT2yMBWTuWNBVrIoChkzyunOLJEYcuaHO14HmPDoSis+zwks9YAJe7KS9+ Cm01+7LhG+4UY3256RWGmCDHBCc0bKIOyPfkF0hukZ5HqWs3VBjw7yqAi6eJeFgusqxK hfhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=iDmiQjbbs+ncOaSPZQyrQa9MO3yFcmcOHTqsF/1P1Eo=; b=GFszk1/z+NgAwhZKyfI4QXF2mJJBnizGZHdV7xYACl6kK/qtZiut5yW99urQHaFIcS qj46lalbP4FQsAt80mnLHvomc9dT8dNyOakwE5gg9sTCgVq9jSrZ9aXuX+DbsiEH6+t9 tGW5dE1DhDbpzOTVDJvxGLNkrUKcH9Dg6D/MN6c/WYmpQYxfKiqzIfgy7cppQz16YSTI Scda8IkTBcBUgyrwWxbKiIpiQMmQyGlNYqO3n8/bN1ab1ZrhpQ3LRB3O+Kd4YUrhYZHY hhmA2WAR1mS3fN8UfxsgJpQYqOYETq0O31R1NEjynoRnO3oOzVHDAPqQShVaQxHxHaZd xfUQ== X-Gm-Message-State: AFeK/H25evbducxtrUYhf5u4EItH+LjzcbkXMB+bYaRI8a+h9Jf6pJmqZ0BdczXNms5TGOA0xLjyJ1TqkhbMqv3r X-Received: by 10.107.50.206 with SMTP id y197mr5603384ioy.214.1490992697451; Fri, 31 Mar 2017 13:38:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.184.70 with HTTP; Fri, 31 Mar 2017 13:38:16 -0700 (PDT) In-Reply-To: <20170301223101.GA17022@savin.petertodd.org> References: <20170224010943.GA29218@savin.petertodd.org> <20170224025811.GA31911@savin.petertodd.org> <20170224031531.GA32118@savin.petertodd.org> <20170224043613.GA32502@savin.petertodd.org> <20170225041202.GA11152@savin.petertodd.org> <20170301223101.GA17022@savin.petertodd.org> From: Bram Cohen Date: Fri, 31 Mar 2017 13:38:16 -0700 Message-ID: To: Peter Todd Content-Type: multipart/alternative; boundary=001a1144795418427b054c0ccada X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Bitcoin Protocol Discussion Subject: Re: [bitcoin-dev] A Better MMR Definition X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Mar 2017 20:38:18 -0000 --001a1144795418427b054c0ccada Content-Type: text/plain; charset=UTF-8 On Wed, Mar 1, 2017 at 2:31 PM, Peter Todd wrote: > > A better way to present your work would have been to at least explain that > at > the top of the file, and perhaps even better, split the reference > implementation and optimized implementation into two separate files. If > you did > this, you'd be more likely to get others to review your work. > I've now added explanation to the README, reorganized the files, and added some comments: https://github.com/bramcohen/MerkleSet In fact, I'd suggest that for things like edge cases, you test edge cases in > separate unit tests that explain what edge cases you're trying to catch. > The tests work by doing a lot of exercising on pseudorandom data, an approach which does a good job of hitting all the lines of code and edge cases and requiring very little updating as the implementation changes, at the expense of it taking a while for tests to run. The advantage of very custom unit tests is that they run almost instantly, at the cost of requiring painstaking maintenance and missing more stuff. I've come to favor this approach in my old age. The proportion of code devoted to tests is more than it looks like at first blush, because all the audit methods are just for testing. --001a1144795418427b054c0ccada Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On W= ed, Mar 1, 2017 at 2:31 PM, Peter Todd <pete@petertodd.org>= wrote:

A better w= ay to present your work would have been to at least explain that at
the top of the file, and perhaps even better, split the reference
implementation and optimized implementation into two separate files. If you= did
this, you'd be more likely to get others to review your work.

I've now added explanation to the README, re= organized the files, and added some comments:


In fact, I'd suggest that for things like edge cases, you= test edge cases in
separate unit tests that explain what edge cases you're trying to catch= .

The tests work by doing a lot of exer= cising on pseudorandom data, an approach which does a good job of hitting a= ll the lines of code and edge cases and requiring very little updating as t= he implementation changes, at the expense of it taking a while for tests to= run. The advantage of very custom unit tests is that they run almost insta= ntly, at the cost of requiring painstaking maintenance and missing more stu= ff. I've come to favor this approach in my old age.

The proportion of code devoted to tests is more than it looks like at= first blush, because all the audit methods are just for testing.

--001a1144795418427b054c0ccada--