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: String encoding in json.c Date: Tue, 26 Dec 2017 06:35:29 +0200 Message-ID: <83efnihzse.fsf@gnu.org> References: <83tvwhjyi5.fsf@gnu.org> <83po72ixs6.fsf@gnu.org> <5e8f561a-fac1-1dbb-1686-d04ef4dfa42c@yandex.ru> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1514262834 12664 195.159.176.226 (26 Dec 2017 04:33:54 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 26 Dec 2017 04:33:54 +0000 (UTC) Cc: p.stephani2@gmail.com, emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 26 05:33:50 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 1eTgw0-0002ri-49 for ged-emacs-devel@m.gmane.org; Tue, 26 Dec 2017 05:33:48 +0100 Original-Received: from localhost ([::1]:51477 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eTgxy-0000Vq-Oy for ged-emacs-devel@m.gmane.org; Mon, 25 Dec 2017 23:35:50 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eTgxZ-0000G4-7T for emacs-devel@gnu.org; Mon, 25 Dec 2017 23:35:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eTgxU-0003Jq-Uz for emacs-devel@gnu.org; Mon, 25 Dec 2017 23:35:25 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:48898) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eTgxU-0003Jk-LV; Mon, 25 Dec 2017 23:35:20 -0500 Original-Received: from [176.228.60.248] (port=3173 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eTgxU-0001yJ-3x; Mon, 25 Dec 2017 23:35:20 -0500 In-reply-to: <5e8f561a-fac1-1dbb-1686-d04ef4dfa42c@yandex.ru> (message from Dmitry Gutov on Mon, 25 Dec 2017 22:51:22 +0200) 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:221414 Archived-At: > Cc: p.stephani2@gmail.com, emacs-devel@gnu.org > From: Dmitry Gutov > Date: Mon, 25 Dec 2017 22:51:22 +0200 > > On 12/25/17 6:21 PM, Eli Zaretskii wrote: > > > OK, but I presume the size of such buffers is rarely more than 1 > > MByte, say? > > Maybe not. This bug report: > https://github.com/abingham/emacs-ycmd/issues/163 mentioned large > translation units, but I'm not sure which exact sizes are in play. The > reproduction scenario used a 300 KB example, encoding which was quite > slow at the time. I'd expect the Jansson configuration to do that at least 10 to 20 times faster. > > Files we visit are quite frequently much larger. Which > > is why I say that if the speed of en/decoding is crucial, we should > > first and foremost work on speeding up file I/O. > > If you mean I/O in general, maybe. No, I meant file I/O specifically. Our implementation of encoding and decoding is separate for each one of: (a) file I/O, (b) process and network I/O, (c) string encoding/decoding, (d) file-name encoding and decoding (maybe I forget some). > I'm not sure which encoding speeds json.c allows us now. Well, Philipp measured it, so maybe he could share the benchmarks and the results. > But the JSON structure I was talking about is not written to a file. > It's sent over the network (usually to a local TCP socket). In that case, encoding it is not a wasted effort, since it would have been otherwise encoded when we send it.