[hybi] Performance of Vector XOR

"Bob Gezelter" <gezelter@rlgsc.com> Wed, 07 September 2011 20:29 UTC

Return-Path: <gezelter@rlgsc.com>
X-Original-To: hybi@ietfa.amsl.com
Delivered-To: hybi@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 5F7EF21F8CAE for <hybi@ietfa.amsl.com>; Wed, 7 Sep 2011 13:29:47 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.619
X-Spam-Level:
X-Spam-Status: No, score=-1.619 tagged_above=-999 required=5 tests=[AWL=-0.880, BAYES_20=-0.74]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1sus7kyOSF5d for <hybi@ietfa.amsl.com>; Wed, 7 Sep 2011 13:29:45 -0700 (PDT)
Received: from smtpoutwbe09.prod.mesa1.secureserver.net (smtpoutwbe09.prod.mesa1.secureserver.net [208.109.78.21]) by ietfa.amsl.com (Postfix) with SMTP id 68AC621F85D1 for <HYBI@ietf.org>; Wed, 7 Sep 2011 13:29:42 -0700 (PDT)
Received: (qmail 24095 invoked from network); 7 Sep 2011 20:31:29 -0000
Received: from unknown (HELO localhost) (72.167.218.132) by smtpoutwbe09.prod.mesa1.secureserver.net with SMTP; 7 Sep 2011 20:31:29 -0000
Received: (qmail 17413 invoked by uid 99); 7 Sep 2011 20:31:29 -0000
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="utf-8"
X-Originating-IP: 141.157.213.69
User-Agent: Web-Based Email 5.5.18
Message-Id: <20110907133128.ef1fc80126c74c6c202a919c41c7bb0b.a42c8f016b.wbe@email03.secureserver.net>
From: Bob Gezelter <gezelter@rlgsc.com>
To: len.holgate@gmail.com, Tobias Oberstein <tobias.oberstein@tavendo.de>, rbarnes@bbn.com
Date: Wed, 07 Sep 2011 13:31:28 -0700
Mime-Version: 1.0
Cc: HYBI@ietf.org
Subject: [hybi] Performance of Vector XOR
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/hybi>, <mailto:hybi-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/hybi>
List-Post: <mailto:hybi@ietf.org>
List-Help: <mailto:hybi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 07 Sep 2011 20:29:47 -0000

Len, Tobias, Richard,

I would recommend extreme caution on using rough JavaScript or even
Python benchmarks as a test for the execution efficiency of the masking
operation (Note: I say this as one who is unconvinced of the benefits of
masking).

A well-written, straight vector XOR of a message should not be an
extremely expensive operation. I would be loath to believe that modern
processors cannot effectively perform this operation. With all due
respect to the implementers, it is far more likely that the JavaScript
(and quite possibly Python) use data structures and representations that
were not designed for this type of vector operation.

In a real situation, the XOR would be done in code that is likely
written in C/C++ or a similar language. If there is a real concern on
this issue, then the analysis should be done at the level of precisely
what machine instructions are actually being executed. As a former code
generator writer, I can attest that it is quite easy to gain or lose
efficiency at this level (for example, I would be unsurprised to
discover that JavaScript and Python are doing the XOR one byte at a
time, rather than in 64-bit chunks; that alone would account for nearly
an order of magnitude performance hit).

- Bob Gezelter, http://www.rlgsc.com