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 02:22:43 -0700 (PDT)
User-agent: G2/1.0

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 
encoding 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.
> > 
> > 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]