From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: String encoding in json.c Date: Sat, 23 Dec 2017 14:26:09 +0000 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c062a587c04c6056102b772" X-Trace: blaine.gmane.org 1514039105 24572 195.159.176.226 (23 Dec 2017 14:25:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 23 Dec 2017 14:25:05 +0000 (UTC) To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 23 15:25:01 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 1eSkjU-0005wt-R4 for ged-emacs-devel@m.gmane.org; Sat, 23 Dec 2017 15:25:00 +0100 Original-Received: from localhost ([::1]:42155 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSklT-0006hp-7N for ged-emacs-devel@m.gmane.org; Sat, 23 Dec 2017 09:27:03 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42652) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSkkn-0006hj-Gr for emacs-devel@gnu.org; Sat, 23 Dec 2017 09:26:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSkkm-0004OC-NC for emacs-devel@gnu.org; Sat, 23 Dec 2017 09:26:21 -0500 Original-Received: from mail-qk0-x233.google.com ([2607:f8b0:400d:c09::233]:44155) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eSkkm-0004Nj-HR for emacs-devel@gnu.org; Sat, 23 Dec 2017 09:26:20 -0500 Original-Received: by mail-qk0-x233.google.com with SMTP id v188so10376742qkh.11 for ; Sat, 23 Dec 2017 06:26:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=sLY/DHmSV5jO4shrIeah1OWH9N42ORONM5QJii0XVBU=; b=rlHQfltnCofdc0JfEzw/NDppK42n++4/slOlL/gD/xesFqEWyHUt1J3fx7hwlLvSfH W2kmFK+mqANl3yZx0FNdcmPBnnJKoaPLQPhGOwCg9t00XXq0gx+rmpokStWhskyVLMaY 3Csch1QT9JPSUzDBdxZ04W9cdwreWiwL+jzbU3eD8/dtp40t+AOizE1ef3fThfKnaZJs H6fTPXqdaIU/ZQw4ma76gnoX5aMKjjxhCGhrvj+75vJIp2KWgV4h9e3DZXysiZSHu4mL drGhdd8xTZgCkAcDKQnJO1N8GXsz36w75/TtYRzT8YfNbKV/aGgk4EFQOgVnSmESnwxr Ea3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=sLY/DHmSV5jO4shrIeah1OWH9N42ORONM5QJii0XVBU=; b=peLOjONOXt9lOINU8AxK15VBlXDY2mcW/hFgRCpdu2LeeGefrKDP1p0N1GjSCohuDr 5Q687x80nIcE7xfDCZFW0BhlA/0vNN//VQc3ZrZw74rbyP5xiOU0PHiqYp7BOOVoppOS Z3op0JSkbMYbqyPEKGSUksX3D0nm5xh5R1wHlwK+cgNN9LqO3T4xASJgWTGYNda6/uWk p2YoqEiKpCDAiJ2hEF6wR5RwN96LNd2LqSucEaB3aMTBXbbi80LUC9cRdp1tcWmcaPkb Qn7XA3fPSF07aWRYvuvADpbcQ6/BIKhATBQwGL8CH1rmmCYg0zbk0wl7vjh6Q+K/pG4t xXbQ== X-Gm-Message-State: AKGB3mLJN48ZGyQcad2I86YC+OdehAFFe/0FCcFfLpbfthielURr/AnA hzFAUKU+K6sDT8izh83u0zZN+MfuZTlaenKZ+oLDPg== X-Google-Smtp-Source: ACJfBovGnl1xWKra76twiuiFErFtUlX0HPdZwxjqE+xVfS4y8UnPrH0iqtFUT+5y07QWDQmu251HSwxZ2YBQQzC9oNw= X-Received: by 10.55.122.134 with SMTP id v128mr23734252qkc.354.1514039179738; Sat, 23 Dec 2017 06:26:19 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::233 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:221372 Archived-At: --94eb2c062a587c04c6056102b772 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, I've benchmarked serialization and parsing of JSON with and without explicit encoding. I've found that leaving out the coding makes both operations significantly faster =E2=80=93 from a speedup of a factor of 1.1= 1 =C2=B1 0.06 for parsing canada.json to 1.57 =C2=B1 0.08 for serializing twitter.json. O= ther speedups are in between, but the speedup is always significant (to at least one standard deviation). All unit tests pass when leaving out the coding steps =E2=80=93 which isn't surprising given that currently the coding oper= ations are expensive no-ops. Therefore I'd suggest to document the internal string encoding in lisp.h or character.h and remove the explicit coding in json.c and emacs-module.c. It's very unlikely that the internal string encoding will change frequently, and if so, the unit tests should catch potential issues caused by that. Philipp --94eb2c062a587c04c6056102b772 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

I've benchmarked serialization = and parsing of JSON with and without explicit encoding. I've found that= leaving out the coding makes both operations significantly faster =E2=80= =93 from a speedup of a factor of 1.11 =C2=B1 0.06 for parsing canada.json = to 1.57 =C2=B1 0.08 for serializing twitter.json. Other speedups are in bet= ween, but the speedup is always significant (to at least one standard devia= tion). All unit tests pass when leaving out the coding steps =E2=80=93 whic= h isn't surprising given that currently the coding operations are expen= sive no-ops. Therefore I'd suggest to document the internal string enco= ding in lisp.h or character.h and remove the explicit coding in json.c and = emacs-module.c. It's very unlikely that the internal string encoding wi= ll change frequently, and if so, the unit tests should catch potential issu= es caused by that.

Philipp
--94eb2c062a587c04c6056102b772--