From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: yyoncho Newsgroups: gmane.emacs.bugs Subject: bug#31138: Native json slower than json.el Date: Tue, 23 Apr 2019 18:36:18 +0300 Message-ID: References: <87sh806xwa.fsf@chapu.is> <83r2a2hdxn.fsf@gnu.org> <21f68973-a684-2a65-82eb-c8f3df90127f@yandex.ru> <83d0lmgez2.fsf@gnu.org> <7d503be9-4d85-3d0b-6829-631ad376ba3d@yandex.ru> <831s22gcci.fsf@gnu.org> <83y349gasn.fsf@gnu.org> <83d0lfag4x.fsf@gnu.org> <5cf45a21-65c3-67ee-f123-be83a6ee7c99@yandex.ru> <83a7gjaen6.fsf@gnu.org> <83ftqa8qsg.fsf@gnu.org> <83muki6y6r.fsf@gnu.org> <4b8c6799-e845-768b-749c-f2a883ab89f8@yandex.ru> <83h8aq6v6a.fsf@gnu.org> <834l6q6ozn.fsf@gnu.org> <83zhoi59ao.fsf@gnu.org> <83wojm57sl.fsf@gnu.org> <83ftq96azk.fsf@gnu.org> <83wojk534g.fsf@gnu.org> <6308ceff-479b-2ce7-2072-41e683978c7c@yandex.ru> <83ef5s4v24.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000051f35305873459b7" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="100116"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Philipp Stephani , =?UTF-8?Q?S=C3=A9bastien?= Chapuis , Dmitry Gutov , 31138@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 23 17:37:14 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1hIxTt-000PvM-I5 for geb-bug-gnu-emacs@m.gmane.org; Tue, 23 Apr 2019 17:37:13 +0200 Original-Received: from localhost ([127.0.0.1]:55516 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIxTs-0000mW-CU for geb-bug-gnu-emacs@m.gmane.org; Tue, 23 Apr 2019 11:37:12 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:35067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIxTj-0000mK-V6 for bug-gnu-emacs@gnu.org; Tue, 23 Apr 2019 11:37:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIxTi-00064e-R8 for bug-gnu-emacs@gnu.org; Tue, 23 Apr 2019 11:37:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40566) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hIxTi-00064Y-Ng for bug-gnu-emacs@gnu.org; Tue, 23 Apr 2019 11:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hIxTi-0002HC-HI for bug-gnu-emacs@gnu.org; Tue, 23 Apr 2019 11:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: yyoncho Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 Apr 2019 15:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31138 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 31138-submit@debbugs.gnu.org id=B31138.15560337978719 (code B ref 31138); Tue, 23 Apr 2019 15:37:02 +0000 Original-Received: (at 31138) by debbugs.gnu.org; 23 Apr 2019 15:36:37 +0000 Original-Received: from localhost ([127.0.0.1]:54110 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIxTJ-0002GY-Ja for submit@debbugs.gnu.org; Tue, 23 Apr 2019 11:36:37 -0400 Original-Received: from mail-lj1-f171.google.com ([209.85.208.171]:46281) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIxTI-0002GE-4S for 31138@debbugs.gnu.org; Tue, 23 Apr 2019 11:36:36 -0400 Original-Received: by mail-lj1-f171.google.com with SMTP id h21so13914428ljk.13 for <31138@debbugs.gnu.org>; Tue, 23 Apr 2019 08:36:36 -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; bh=TzNnDgpPH90fN0WQTqppOC+RAqlq2jxlxnxQCq4BClk=; b=aah3aadsLnBLcEaySAlbxILTLjzHGBHy5ENqupSBZr7+AdRCsmGQw6DTlSmSub60GE AQzbP2YAo1qjKjilUf1042ko7hHVs/w8xeVfIsvQxOfKEXJjusECOyX2LT6pdYtl8X6A Sc3Hb+Mlwsch9irZLd0M+RsJ5o8CGZ04zORGOonV3H9wP0Qj8FYvVFhrDQlRwaIFDi5N Jt1muXfNYwoM78LZi/kshMqCsx4nYTa+KL6nw5WhSxR4ID5ddRv11ZSwoRUemF0GI5oX P718sVvFIK/9i/ONxbQUmSnrmsim60xFy5xSg75WgugWkVTzdQzyZKpJ6Xs1SqPkg65U JIYQ== 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; bh=TzNnDgpPH90fN0WQTqppOC+RAqlq2jxlxnxQCq4BClk=; b=n+Xdg44P8c5Qic6TtrgldfiYgnmoGu4hIAm5Nf+I04S/zPVJ7tcYLRnA1To7hmjJM/ MsSrjaSYTRPC43scwMZcI2z6BNgeetseELb7mX0TXZodfT88YAw7hCYPzRQRenxOrXcM IJTuHTms+8XJKcvBNE9PFTexpUmQP6u8aunLPHWF30RzUqZe83hgSz+hroGQCMFmW+GG h+PZdIVXSzRHxbCV1Uxa2pJYZ0UFD8w5jVd8Ioc8q4DV5V2njKyYJo86yKNiTT35WEDP A/wk86ABTFxt72CuX9DFSdiqH7ciIDF0XbEQyxPt7wkeKLZ/pmsgpRiX248iNDB28zAY IkRg== X-Gm-Message-State: APjAAAX34LVWejN1Rgz/tI+BwASroLLFHWmEGzlovJqk37qTwJeQh3s5 2r5AMrj4VwEj6KVb05n8YUPYVIPhYKFDx2JTRxg= X-Google-Smtp-Source: APXvYqyMxqaKJ6w3pXboskdxHZG+ea5TCvdfEp+vpV+PXjyyTOzLfvypuqSXgOKj94yJ8YR66Q00hqJgL4fK8CEIeV8= X-Received: by 2002:a2e:8895:: with SMTP id k21mr2901140lji.43.1556033790144; Tue, 23 Apr 2019 08:36:30 -0700 (PDT) In-Reply-To: <83ef5s4v24.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:158144 Archived-At: --00000000000051f35305873459b7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Eli, Another posibility is to have two string convertion methods. Thanks, Ivan On Tue, Apr 23, 2019 at 6:10 PM Eli Zaretskii wrote: > > From: Philipp Stephani > > Date: Tue, 23 Apr 2019 16:40:10 +0200 > > Cc: Eli Zaretskii , S=C3=A9bastien Chapuis , > > > yyoncho , 31138@debbugs.gnu.org > > > > For starters, the module code in emacs-module.c (e.g. > > module_make_string) has essentially the same requirements. So we could > > at least move json_make_string, json_build_string, and json_encode > > into coding.[ch] (and rename them). > > If we want to make this more general-purpose, we should time the code > with very long strings. It could be that beyond some length the UTF-8 > verification, if it fails, will make the conversion slower, in which > case we probably should not take the shortcut beyond that length > limit. > > Or we might document that non-UTF-8 strings will be slower to convert, > if that's acceptable. > --00000000000051f35305873459b7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Eli,

Another posibility is to have t= wo string convertion methods.

Thanks,
Iv= an

On Tue, Apr 23, 2019 at 6:10 PM Eli Zaretskii <eliz@gnu.org> wrote:
> From: Philipp Stephani <p.stephani2@gmail.com> > Date: Tue, 23 Apr 2019 16:40:10 +0200
> Cc: Eli Zaretskii <eliz@gnu.org>, S=C3=A9bastien Chapuis <sebastien@chapu.is>,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0yyoncho <yyoncho@gmail.com>, 31138@debbugs.gnu.org
>
> For starters, the module code in emacs-module.c (e.g.
> module_make_string) has essentially the same requirements. So we could=
> at least move json_make_string, json_build_string, and json_encode
> into coding.[ch] (and rename them).

If we want to make this more general-purpose, we should time the code
with very long strings.=C2=A0 It could be that beyond some length the UTF-8=
verification, if it fails, will make the conversion slower, in which
case we probably should not take the shortcut beyond that length
limit.

Or we might document that non-UTF-8 strings will be slower to convert,
if that's acceptable.
--00000000000051f35305873459b7--