From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sam Halliday Newsgroups: gmane.emacs.help Subject: Re: how to calculate the size of string in bytes? Date: Wed, 19 Aug 2015 02:22:43 -0700 (PDT) Message-ID: References: <20150818101352.GA6744@tuxteam.de> <8a03e8f4-b65d-4b42-941b-6fc0624ffada@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1439976323 11952 80.91.229.3 (19 Aug 2015 09:25:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 19 Aug 2015 09:25:23 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 19 11:25:23 2015 Return-path: Envelope-to: geh-help-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 1ZRzcY-0004H8-DP for geh-help-gnu-emacs@m.gmane.org; Wed, 19 Aug 2015 11:25:22 +0200 Original-Received: from localhost ([::1]:32929 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRzcX-0004B9-Nc for geh-help-gnu-emacs@m.gmane.org; Wed, 19 Aug 2015 05:25:21 -0400 X-Received: by 10.68.168.1 with SMTP id zs1mr9553472pbb.6.1439976163702; Wed, 19 Aug 2015 02:22:43 -0700 (PDT) X-Received: by 10.140.101.129 with SMTP id u1mr147708qge.27.1439976163655; Wed, 19 Aug 2015 02:22:43 -0700 (PDT) Original-Path: usenet.stanford.edu!news.glorb.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!se8no6298195igc.0!news-out.google.com!78ni16721qge.1!nntp.google.com!y105no1510703qge.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: <8a03e8f4-b65d-4b42-941b-6fc0624ffada@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=83.244.128.25; posting-account=kRukCAoAAAANs-vsVh9dFwo5kp5pwnPz Original-NNTP-Posting-Host: 83.244.128.25 User-Agent: G2/1.0 Injection-Date: Wed, 19 Aug 2015 09:22:43 +0000 X-Received-Bytes: 2536 X-Received-Body-CRC: 2726488968 Original-Xref: usenet.stanford.edu gnu.emacs.help:214425 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:106707 Archived-At: Actually, one question Stefan. An advantage of the string encodings is that we're pretty confident that a = newline will flush the network buffer. How do we make sure that a binary en= coding will do the same? (or is there no buffering and we're worrying about= nothing) On Wednesday, 19 August 2015 09:57:38 UTC+1, Sam Halliday wrote: > On Tuesday, 18 August 2015 22:47:44 UTC+1, Stefan Monnier wrote: > > > It seems somewhat wasteful to encode msg (to find its length) just > > > to let process-send-string encode again -- perhaps there's a better > > > idiom around for that. > >=20 > > Yup: communicate with the process using bytes rather than chars! > >=20 > > I.e. set the process's coding system to binary. > >=20 > > Then you just need to call (encode-coding-string msg coding-system) onc= e > > to get the bytes and you send them as is: they won't be re-encoded. > >=20 > >=20 > > Stefan >=20 > Heh, that's actually a very good suggestion. We'll keep that in mind if t= his is ever a performance bottleneck. We're hoping to move the ENSIME proto= col (based on SWANK) over to S-Expressions over WebSockets which will mean = we can just delete all this code.