From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.devel Subject: Re: Add support for base64url variant Date: Thu, 23 May 2019 14:45:51 -0400 Message-ID: References: <87pnobiglo.fsf@killashandra.ballybran.fr> <837eaj7x37.fsf@gnu.org> <3b0dc49f9831435178dc1b64d6a2f5c7@free.fr> <83zhne7r8d.fsf@gnu.org> <87blzt6ovv.fsf@killashandra.ballybran.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="163700"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Eli Zaretskii , Emacs developers To: =?UTF-8?Q?Pierre_T=C3=A9choueyres?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 23 20:47:12 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hTskB-000gOz-Ea for ged-emacs-devel@m.gmane.org; Thu, 23 May 2019 20:47:11 +0200 Original-Received: from localhost ([127.0.0.1]:41842 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTsk9-0004ge-SQ for ged-emacs-devel@m.gmane.org; Thu, 23 May 2019 14:47:09 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:42485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTsjC-0004gU-Qa for emacs-devel@gnu.org; Thu, 23 May 2019 14:46:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTsjB-0005eM-Tj for emacs-devel@gnu.org; Thu, 23 May 2019 14:46:10 -0400 Original-Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]:44803) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTsj8-0005VD-V7; Thu, 23 May 2019 14:46:07 -0400 Original-Received: by mail-oi1-x231.google.com with SMTP id z65so5146518oia.11; Thu, 23 May 2019 11:46:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=sErKe0yzRx+WiT4CXY9QHG4i6Qoffu7BS/N36NsCMXM=; b=BUYZfrrJhei2Pa2/JB0bVCYwDjlox7Gpfn8orKKr4ZjDDBd/McPWdTRzTC3tquZMYQ pJKtlDhG7ko+2Xrg7yZnub01ApvvxHTo6pD/L+0k8VM9CZPOPtwVLf2WnWLx5TRFPi+H iigk0pa/GNlaagPsEVNh5Q7UIYoaEsZFwBi9fgSiQCklh3feyhE/zCnNwNmgFtL23oMw /ihFJaehxBuHbnx/iYknUJmeK+fOPgnd+zYQtqm4Rx9GVcDdY9pBJDmExLPeQ1hsjjhp qzsSwn+X619cSoeEvBX7WSybo/38HXkmSli4/nxq3DJv4HLhL/h2zE/3X7/fmNEuvtWi kbNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=sErKe0yzRx+WiT4CXY9QHG4i6Qoffu7BS/N36NsCMXM=; b=kzKe7yrfs+tp2hkpGaSLKe1j5lqD13Kik87QAvAWTgL4E23pmhnZXMxdU6dSskS8Mp XE8bb9RCS5nCxDbd55dUTPXSQyDR9VPUk6orlsDnggiEWyrGzR0OpqRohostrRFelMdl 3T6+ciRtmihRenqS4PUvA8MVxK46tjD7ujaPXRJ3Qn/Ma2xyhaVk84tDQcOcA5kj3OMy qNnVnjEGhwmysDylXLNVnKXPHxqcF4IRPeuKc6Tu+UYeETP1jnBoaIPjb+7u34satwq+ FwF0480E8NUCWsYZxROo3E+bRheU6eImUFAy2t7AxpDjLVaOt+zVihdkDMbbxdkbDCVC +tlQ== X-Gm-Message-State: APjAAAUFCaCFrZUX3gzjxjFAoJJTP9Zfk1orYroqEeeKI9xp4d5sAUdB Kh5epW2y71ug69N44KPijEbW7JkWUgrhDVHmJhs= X-Google-Smtp-Source: APXvYqwXLENxCKSWQcBtY3F/I6tVzoiG9P8wkrsy3hR8eHSLfMffvEh0F44Ctc/OZ0hUFbdQtSfJrZGMNpg0fOpSVNI= X-Received: by 2002:aca:4d0c:: with SMTP id a12mr3695918oib.23.1558637166083; Thu, 23 May 2019 11:46:06 -0700 (PDT) In-Reply-To: <87blzt6ovv.fsf@killashandra.ballybran.fr> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::231 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:236942 Archived-At: On Thu, 23 May 2019 at 13:51, Pierre T=C3=A9choueyres wrote: > > Eli Zaretskii writes: > > >> ... > >> I would like to have some discussion on how to improve some points : > >> - Is adding parameter to existing functions the way to go or is it > >> better to add new ones for base64url > > > > I think an optional argument will be fine. > > Except here I've added two, and one that doesn't really mean anything if > the second isn't set. ie. you should not (at least without breaking the > RFC) generate an base64 string without padding. At first many > parameters seemed to me a good thing : limitted patch and flexibility. > But now I'm no more sure ... You could leave out the NO-PAD argument, it's easy enough for the calling Lisp code to delete a couple of "=3D" chars if really needed. > I would also bring your attention on the part where I dynamically assign > pointers on specialized arrays for encoding (resp. decoding). > > ex: line 244 of patch > > char const *b64_value_to_char =3D (url_variant) ? base64url_value_to_char= : base64_value_to_char; > > > Before my change there were static const, so I suppose compiler could > have inlined them or at least stored on some cache. But now ... > So I'm a little scarried by the possible lost of performance. If anyone > has some hint on how I could benchmark this I doubt it will have a measurable impact on performance. And even if it did have some very tiny effect, what would you do about it? Duplicate the whole encoding function, just to avoid a dynamic choice of array? The difference would have to be pretty drastic to be worth that, IMO.