From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: JSON/YAML/TOML/etc. parsing performance Date: Mon, 09 Oct 2017 09:38:45 +0300 Message-ID: <83lgkksu4q.fsf@gnu.org> References: <87poaqhc63.fsf@lifelogs.com> <8360ceh5f1.fsf@gnu.org> <83h8vl5lf9.fsf@gnu.org> <83r2um3fqi.fsf@gnu.org> <43520b71-9e25-926c-d744-78098dad6441@cs.ucla.edu> <83o9pnzddc.fsf@gnu.org> <472176ce-846b-1f24-716b-98eb95ceaa47@cs.ucla.edu> <83d163z6dy.fsf@gnu.org> <73477c99-1600-a53d-d84f-737837d0f91f@cs.ucla.edu> <83poa2ya8j.fsf@gnu.org> <21b0ba97-ed49-43ae-e86f-63fba762353a@cs.ucla.edu> <8c922c27-9de0-7d99-6c26-a94a0387c45e@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1507531176 9180 195.159.176.226 (9 Oct 2017 06:39:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 9 Oct 2017 06:39:36 +0000 (UTC) Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org To: Philipp Stephani Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 09 08:39:31 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e1Rit-0001i7-5G for ged-emacs-devel@m.gmane.org; Mon, 09 Oct 2017 08:39:31 +0200 Original-Received: from localhost ([::1]:56345 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1Rj0-0007hk-8n for ged-emacs-devel@m.gmane.org; Mon, 09 Oct 2017 02:39:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49936) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1RiK-0007hc-O2 for emacs-devel@gnu.org; Mon, 09 Oct 2017 02:38:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1RiG-0007UH-99 for emacs-devel@gnu.org; Mon, 09 Oct 2017 02:38:56 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52136) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1RiG-0007UD-5R; Mon, 09 Oct 2017 02:38:52 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4633 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1e1RiF-0004ci-Fv; Mon, 09 Oct 2017 02:38:51 -0400 In-reply-to: (message from Philipp Stephani on Sun, 08 Oct 2017 22:52:36 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:219288 Archived-At: > From: Philipp Stephani > Date: Sun, 08 Oct 2017 22:52:36 +0000 > Cc: emacs-devel@gnu.org > > Paul Eggert schrieb am Do., 5. Okt. 2017 um 03:48 Uhr: > > One idea here is > that there is no need for eassert (E) unless there's a genuine doubt > that E will be true (in some cases the removed eassert (E) calls were > ineffective anyway, due to preceding eassume (E) calls). The patch cuts > down the number of integer overflow checks to six in json.c, if I'm > counting correctly, and that should be good enough. > > I don't understand why minimizing the number of checks and assertions should be a worthwhile goal. At the > very least, the assertions document the assumptions that we make about the values, and as such they are > valuable even if they never trigger. My criterion for adding eassert(E) is that the following conditions all hold: . the code below it assumes E is true . the code below it will not work correctly if E is false, but will not immediately abort or segfault (which also means the code has no defenses against E being false) . E being false "should never happen", i.e. it's deemed impossible