why does the cmdserver use a 4-byte length field?

Idan Kamara idankk86 at gmail.com
Fri Jul 1 08:32:49 CDT 2011


On Fri, Jul 1, 2011 at 1:13 AM, Jesper Schmidt <schmiidt at gmail.com> wrote:
>
> I mean a 2-byte length field seems to be enough for the input channels.

But not for output channels.

>
> The reason why I ask is because it seems that the bytes from length field
> are a non-insignificant part of the total bytes that flow from the server
> to client. At least that is the case in the two examples on the excellent
> wiki page that describes the protocol. I guess the same will be true for
> commands like 'stat', 'log' and 'incoming' if they follow the same
pattern.

It depends on the output of the specific command, but I think it doesn't
make much of a difference (only 2 extra bytes for small chunks).

>
> It could also be that 4-byte integers today are more common than 2-byte
> integers and therefore easier to work with in some newer languages. Is
> that the motivation for choosing 4 bytes over 2 bytes or is 2 bytes
> simply not enough? If 2 bytes are not enough then why are 4 bytes then
> enough?

Theoretically if Mercurial needs to write 4GB in a single call, then it
won't be enough.

>
> --
> Jesper Schmidt
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20110701/1cead4bc/attachment.htm>


More information about the Mercurial-devel mailing list