From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#20154: 25.0.50; json-encode-string is too slow for large strings Date: Sun, 22 Mar 2015 18:47:24 +0200 Message-ID: <550EF21C.6060403@yandex.ru> References: <86twxf68zk.fsf@yandex.ru> <83384zwxdx.fsf@gnu.org> <550C3218.4000903@yandex.ru> <831tkjww0y.fsf@gnu.org> <550C3AB9.7020403@yandex.ru> <83wq2bveq6.fsf@gnu.org> <550C491A.6000909@yandex.ru> <83siczvcss.fsf@gnu.org> <550C504A.10708@yandex.ru> <83r3sjva0q.fsf@gnu.org> <550C6A06.6040203@yandex.ru> <83fv8zv0b1.fsf@gnu.org> <550C9E7B.4060907@yandex.ru> <837fuavkn9.fsf@gnu.org> <550DDE25.1090000@yandex.ru> <550E0097.9000500@yandex.ru> <550ED713.2010201@yandex.ru> <87384xvwi3.fsf@violet.siamics.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1427042903 1564 80.91.229.3 (22 Mar 2015 16:48:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 22 Mar 2015 16:48:23 +0000 (UTC) To: 20154@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 22 17:48:13 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YZj2o-0007PV-UA for geb-bug-gnu-emacs@m.gmane.org; Sun, 22 Mar 2015 17:48:11 +0100 Original-Received: from localhost ([::1]:51700 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YZj2o-0002Cg-Bo for geb-bug-gnu-emacs@m.gmane.org; Sun, 22 Mar 2015 12:48:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YZj2l-0002CQ-Mf for bug-gnu-emacs@gnu.org; Sun, 22 Mar 2015 12:48:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YZj2g-0002xO-NZ for bug-gnu-emacs@gnu.org; Sun, 22 Mar 2015 12:48:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42829) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YZj2g-0002xK-Ju for bug-gnu-emacs@gnu.org; Sun, 22 Mar 2015 12:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YZj2g-00042w-Ez for bug-gnu-emacs@gnu.org; Sun, 22 Mar 2015 12:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 22 Mar 2015 16:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20154 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20154-submit@debbugs.gnu.org id=B20154.142704285615515 (code B ref 20154); Sun, 22 Mar 2015 16:48:02 +0000 Original-Received: (at 20154) by debbugs.gnu.org; 22 Mar 2015 16:47:36 +0000 Original-Received: from localhost ([127.0.0.1]:60838 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YZj2F-00042B-T4 for submit@debbugs.gnu.org; Sun, 22 Mar 2015 12:47:36 -0400 Original-Received: from mail-wi0-f173.google.com ([209.85.212.173]:36832) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YZj2D-00041y-Kt for 20154@debbugs.gnu.org; Sun, 22 Mar 2015 12:47:34 -0400 Original-Received: by wibg7 with SMTP id g7so28302737wib.1 for <20154@debbugs.gnu.org>; Sun, 22 Mar 2015 09:47:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=BUfJRX8NnRIa0qHr4/3Ya28iu7jMFiEk62LLIta5U94=; b=yuMGYaftjEgalfJLWsgfxHXeVoxO/3rLetR4XO+5Ep4I4dqq8G7pJgoT8LaDstKuSM b/GrqFr+0wHXoxzVhDFK3xPJxDq5PiO8VzfXDVTGSTA0XE9b9yf7cWBG2xn2z0inpQ2R gPgjyueQnuyxRr1aeBL0vdB2AuunDb8vZQjfc5TlIW/F6tEbrRo3ZhZr6+CmP6Khr8sd IahG4NH+nhdJJRDr2xVnjoYiaQ9SzTuEwWWZU1kCtQ7nzodczvDOKn7hGAoEENjPjQWl yZVOAZ5T27EtbW1rTuUY+f0l/9xXiy9RXS9n9vv4RydmV9jesjjR4ywRzm/QmjnikXVx hrBg== X-Received: by 10.194.85.46 with SMTP id e14mr172462658wjz.110.1427042847822; Sun, 22 Mar 2015 09:47:27 -0700 (PDT) Original-Received: from [192.168.1.3] ([82.102.93.54]) by mx.google.com with ESMTPSA id r3sm15553380wjw.7.2015.03.22.09.47.26 for <20154@debbugs.gnu.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Mar 2015 09:47:27 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Thunderbird/36.0 In-Reply-To: <87384xvwi3.fsf@violet.siamics.net> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:100788 Archived-At: On 03/22/2015 06:15 PM, Ivan Shmakov wrote: > Why not ‘let’ mb above and use (while (setq mb (string-match …)) > …) here (instead of going through match-beginning)? Good point, thanks. It wins a few milliseconds. > Is there a specific reason to prefer rassoc over rassq here? Not at all. Good call, though no performance improvement. > > (push (substring string start l) res) > > (push "\"" res) > > (apply #'concat (nreverse res)))) > > I guess you can (apply #'concat "\"" (substring …) (nreverse …)) > just as well, instead of pushing to the list just before getting > rid of it. Also good idea, but partially. That gets rid of the initial binding for `res', but those (substring ...) value and quote have to go to the end of the string. We can't put them as the last arguments to `apply'. > > Please keep the discussion participants in Cc, even if you prefer not > > to receive the copy email. > > Curiously, per my experience, the practice of Cc:-ing the > subscribers tends to be frowned upon when it comes to the lists > dedicated to free software. For the reasons I do not know or > understand, Emacs lists are apparently an exception, though. To the best of my knowledge, debbugs only sends a copy to the bug's author, and there's no way to subscribe. So that excludes Eli (although he probably subscribes to all bugs anyway).