Re: [hybi] I-D Action: draft-ietf-hybi-thewebsocketprotocol-13.txt

Joel Martin <hybi@martintribe.org> Wed, 07 September 2011 15:30 UTC

Return-Path: <buskanaka@gmail.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 8A53B21F8B35 for <hybi@ietfa.amsl.com>; Wed, 7 Sep 2011 08:30:28 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.976
X-Spam-Level:
X-Spam-Status: No, score=-2.976 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-1]
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 0eSQ49Don4bn for <hybi@ietfa.amsl.com>; Wed, 7 Sep 2011 08:30:25 -0700 (PDT)
Received: from mail-fx0-f44.google.com (mail-fx0-f44.google.com [209.85.161.44]) by ietfa.amsl.com (Postfix) with ESMTP id 6E63D21F8AFB for <hybi@ietf.org>; Wed, 7 Sep 2011 08:30:25 -0700 (PDT)
Received: by fxe6 with SMTP id 6so708307fxe.31 for <hybi@ietf.org>; Wed, 07 Sep 2011 08:32:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=JiaUsWWcCDV3r6suK3+BQdbc092xoYZeDcvzfMoq350=; b=RbkrR1Fsl52NssbFzFuJ+OeCnRtXeJsl4shMwJ07qs4T0ndiatUIdOJ2+abzJjBe42 M0XGjsMJ4ZqwNSBw4XYgaD3ELn076h4vKiv2Nv4ycJuVt8MDX4yUNJ8zYGW7AJjoeBKq 10b7ZBGAPjnxRfKlvxjOEPHB0Hx0XU7zGSKuM=
Received: by 10.223.27.8 with SMTP id g8mr3428932fac.52.1315409534269; Wed, 07 Sep 2011 08:32:14 -0700 (PDT)
MIME-Version: 1.0
Sender: buskanaka@gmail.com
Received: by 10.223.96.71 with HTTP; Wed, 7 Sep 2011 08:31:54 -0700 (PDT)
In-Reply-To: <634914A010D0B943A035D226786325D422C0F6D564@EXVMBX020-12.exch020.serverdata.net>
References: <20110831184207.1514.64093.idtracker@ietfa.amsl.com> <0fc901cc6878$1681eec0$0a00a8c0@Venus> <CAH9hSJb2rH+fX0AnekYxsEkHKzb15aHrg_hDQw1baWLiWBF-3w@mail.gmail.com> <17b501cc6d31$3016d6d0$0a00a8c0@Venus> <C2CBF8E1-ADC8-48F9-AB82-B98151A36A81@bbn.com> <634914A010D0B943A035D226786325D422C0F6D564@EXVMBX020-12.exch020.serverdata.net>
From: Joel Martin <hybi@martintribe.org>
Date: Wed, 07 Sep 2011 10:31:54 -0500
X-Google-Sender-Auth: Fg4QrasKCc6rG1GX4IvV_p8CnzQ
Message-ID: <CAO228Ns7HDhRFusX7z5uGxwudp7Vj+BnE2A=Pg_oSwU4f80ExQ@mail.gmail.com>
To: Tobias Oberstein <tobias.oberstein@tavendo.de>
Content-Type: multipart/alternative; boundary="00151747c108063b1f04ac5ba6d5"
Cc: "hybi@ietf.org" <hybi@ietf.org>
Subject: Re: [hybi] I-D Action: draft-ietf-hybi-thewebsocketprotocol-13.txt
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 15:30:28 -0000

On Wed, Sep 7, 2011 at 8:31 AM, Tobias Oberstein <
tobias.oberstein@tavendo.de> wrote:
>
> at least for the Python/Twisted implementation I can say that - even after
> quite some optimization experiments - the masking is the bottleneck.
>

I notice you are doing the unmasking directly using python code (
https://github.com/oberstet/Autobahn/blob/master/lib/python/autobahn/websocket.py#L635).
Have you tried doing the unmask by offloading it to something like numpy? If
not, you might try something like this:

    numpy.bitwise_xor(data, mask)

You'll need to handle modulus 4 data (since numpy.bitwise_xor wants the data
to be modulus the mask), but that's the general idea. Here is how I do it in
websockify:
https://github.com/kanaka/websockify/blob/6e263063c2b63642a0e17cb91d6b9f6c9365c0c0/websocket.py#L293
My main test is noVNC which doesn't send much data from client to
server,
but I think numpy will do the unmask significantly faster than doing the XOR
in python code directly.

Regards,

Joel Martin (kanaka)