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 01:57:36 -0700 (PDT) Message-ID: <8a03e8f4-b65d-4b42-941b-6fc0624ffada@googlegroups.com> References: <20150818101352.GA6744@tuxteam.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1439974829 20862 80.91.229.3 (19 Aug 2015 09:00:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 19 Aug 2015 09:00:29 +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:00:27 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 1ZRzEO-0000tI-2R for geh-help-gnu-emacs@m.gmane.org; Wed, 19 Aug 2015 11:00:24 +0200 Original-Received: from localhost ([::1]:32809 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRzEN-00023h-FH for geh-help-gnu-emacs@m.gmane.org; Wed, 19 Aug 2015 05:00:23 -0400 X-Received: by 10.66.142.7 with SMTP id rs7mr9527217pab.12.1439974656825; Wed, 19 Aug 2015 01:57:36 -0700 (PDT) X-Received: by 10.140.97.199 with SMTP id m65mr138474qge.29.1439974656584; Wed, 19 Aug 2015 01:57:36 -0700 (PDT) Original-Path: usenet.stanford.edu!x6no1971311igd.0!news-out.google.com!b31ni8679qge.0!nntp.google.com!69no2035413qgi.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: 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 08:57:36 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:214424 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:106706 Archived-At: 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. > > Yup: communicate with the process using bytes rather than chars! > > I.e. set the process's coding system to binary. > > Then you just need to call (encode-coding-string msg coding-system) once > to get the bytes and you send them as is: they won't be re-encoded. > > > Stefan Heh, that's actually a very good suggestion. We'll keep that in mind if this is ever a performance bottleneck. We're hoping to move the ENSIME protocol (based on SWANK) over to S-Expressions over WebSockets which will mean we can just delete all this code.