From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#31138: Native json slower than json.el Date: Mon, 22 Apr 2019 19:44: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> <10ca4e2f-b116-16bc-c81e-24036752c867@yandex.ru> <83lg026xxb.fsf@gnu.org> <0d42dab4-6c5c-be3a-d402-f17b39e7fc3c@yandex.ru> <83k1fm6vly.fsf@gnu.org> <19b19dec-a5a0-e08d-6026-0b9621d38143@yandex.ru> <8336ma6oia.fsf@gnu.org> <83v9z657i0.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="317"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 Cc: p.stephani2@gmail.com, sebastien@chapu.is, yyoncho@gmail.com, 31138@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Apr 22 18:58:01 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 1hIcGW-00189S-9h for geb-bug-gnu-emacs@m.gmane.org; Mon, 22 Apr 2019 18:58:00 +0200 Original-Received: from localhost ([127.0.0.1]:40131 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIcGV-0003bg-Ct for geb-bug-gnu-emacs@m.gmane.org; Mon, 22 Apr 2019 12:57:59 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:45028) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIcDp-00012m-6u for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2019 12:55:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIc3y-0000M3-3a for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2019 12:45:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37886) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hIc3y-0000Ll-0P for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2019 12:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hIc3x-00049h-PR for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2019 12:45:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Apr 2019 16:45:01 +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.155595147115915 (code B ref 31138); Mon, 22 Apr 2019 16:45:01 +0000 Original-Received: (at 31138) by debbugs.gnu.org; 22 Apr 2019 16:44:31 +0000 Original-Received: from localhost ([127.0.0.1]:51427 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIc3T-00048d-JZ for submit@debbugs.gnu.org; Mon, 22 Apr 2019 12:44:31 -0400 Original-Received: from mail-lj1-f176.google.com ([209.85.208.176]:45662) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIc3S-00048R-3d for 31138@debbugs.gnu.org; Mon, 22 Apr 2019 12:44:30 -0400 Original-Received: by mail-lj1-f176.google.com with SMTP id y6so10819155ljd.12 for <31138@debbugs.gnu.org>; Mon, 22 Apr 2019 09:44:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=6wk2Zm+KNYfcxngv4JcQKToyao34vqZmx76sJTyT9HU=; b=i41HiHRF8NIzc3UDFbN69PGU4qiNtdmkN5vDKTsaNL5cl378NNtruAYDdkhvgnBvEK C488OZMlsySCdwtBEwQhpYjvHHvFuTC7G2X+BTlN9AIfX47wNq0LYYL/iijoXXVuO3pC 4vsCxLQt5w5qUuvb0zEMBcuGrp4/aqTm4fuEFvuUohb/aKCWh3JK/mb23v5VBx403Ubl yvP0gVK/YtjNMIQeM7XVLKujeKhGNQ+gpweoIRjqmAqG6caJjU7e4ak/goyhRmkr9KYW CtXtCZRbsu1tG8VenmPMvvfYr2w1k8WdxijDh58VxnUoDl8ymzBUZtPprz2i9G7B/e+j sukA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6wk2Zm+KNYfcxngv4JcQKToyao34vqZmx76sJTyT9HU=; b=So1z5g728dQRDdFfBmDxbXu2WhtL1X0NWcAO6SSPx6KsYbzaXPryDZfbjN5zVdvOd9 +7Jnxlar56ihcU8ySAiHL3N2sZkEiSUldLuOCdAJ6sCPpM+IzWotJmPeNBvYlUsJOUd6 Odgv5IoJywyaM89DYjHAeWMjCWal5qfOp5thuQBI100RrgDNl3FA6Lnw0Zq49NNaknDv A7XeR5AAPJ7XYaVnmxc/aTn0W5TlRAN3e4z/W554S5i2q/BkKQU/EFtZyQbnr+VqumEg R+CJ/4rz9J5wb7oreUYX5PFbFBXQeKynOV83sE0OIl19pK67Aj11QvvJYfHGGtxD9ptO M5Ig== X-Gm-Message-State: APjAAAV8/x0ddhrBJfd7zPtiDc9WdSP9sn1fz65k/vdW4vXyCG9RpBYV WYCqHHdP2fomkgzswy+uVrWqrUA0 X-Google-Smtp-Source: APXvYqyBap80G8vVK9rkJtDRuKCpKFznsiOsJ5UazfC4PkskIP2IWLF7+jQhByyxluwmn8NPRQb6gQ== X-Received: by 2002:a2e:9ec3:: with SMTP id h3mr10899504ljk.131.1555951463223; Mon, 22 Apr 2019 09:44:23 -0700 (PDT) Original-Received: from [192.168.1.3] ([185.105.174.23]) by smtp.googlemail.com with ESMTPSA id h6sm3015954lfp.1.2019.04.22.09.44.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Apr 2019 09:44:22 -0700 (PDT) In-Reply-To: <83v9z657i0.fsf@gnu.org> Content-Language: en-US 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:158063 Archived-At: On 22.04.2019 19:28, Eli Zaretskii wrote: >> Cc: p.stephani2@gmail.com, sebastien@chapu.is, yyoncho@gmail.com, >> 31138@debbugs.gnu.org >> From: Dmitry Gutov >> Date: Mon, 22 Apr 2019 19:16:15 +0300 >> >> All right. Does the attached json_encode_string_ascii_test.diff look >> good to you? > > The size == nchars case not necessarily true just for ASCII, I think, > and the code in parse_str_as_multibyte is more complex than needed > just for ASCII. I meant make a loop that literally checks only for > ASCII_CHAR_P, and nothing more. I think it makes sense to see first > how much can we speed up things for pure ASCII JSONs. OK, I'll try to do what you've described here. In the meantime, I'd like to report that the aforementioned patch, even though too-complex and not entirely correct, provides practically all the performance improvement we get from the no-validation patch. IOW, with my test scenario: current master: 51s no_validation: 21s ascii_test: 22s >> + if (size == nchars) >> + /* Wasn't sure if the last arg should better be true here, but >> + it doesn't seem to affect the behavior or correctness, so far. */ >> + return make_specified_string (data, -1, size, false); > > It should make no difference for ASCII, but I think I prefer to use > 'true' there, for consistency with the other cases. I left 'false' there for testing, to make sure we hit both branches of the condition (the tests still pass).