help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to calculate the size of string in bytes?


From: Sam Halliday
Subject: Re: how to calculate the size of string in bytes?
Date: Wed, 19 Aug 2015 01:57:36 -0700 (PDT)
User-agent: G2/1.0

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]