[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] tnetstrings.lua 1.0.0
- From: Josh Simmons <simmons.44@...>
- Date: Sun, 5 Jun 2011 23:48:58 +1000
On Sun, Jun 5, 2011 at 11:27 PM, Florian Weimer <fw@deneb.enyo.de> wrote:
> * Josh Simmons:
>
>> * Trivial to parse in every language without making errors.
>
> Apparently, this is not entirely true:
>
> val, ext = parse(ext)
>
> -- If val is nil, then ext is actually an error message.
> if not val then
> return val, ext
> end
>
> local val, ext = parse(ext)
> if not val then
> return nil, ext
> end
>
Haha, fixed.
> Your implementation does not round-trip, either.
It seems to, according to the tests.
>
>> * Resistant to buffer overflows and other problems.
>
> Your implementation results in near-quadratic run time in terms of the
> input string length.
As far as I can tell, there's not a huge amount that can be done about
that. But I'm open to suggestions.
>
>> * Fast and low resource intensive.
>
> The format requires buffering all data before decoding can start.
> This means that decoding arbitrary messages requires unbounded
> storage.
You can't really get around that while still maintaining "Makes no
assumptions about string contents" and at any rate it's more a goal to
be able to predict that than actually handle it.
>
>> * Transport agnostic, so it works with streams, messages, files,
>> anything that's 8-bit clean.
>
> The format is non-streaming, so it cannot itself serve as a transport
> for byte streams.
It has to be chunked indeed, but very rarely is a true streaming
system actually implemented. Especially not in the context the
protocol was designed for, internal communication for a web server
(mongrel2).