Re: XML smaller?

Date view Thread view Subject view Author view

From: Kragen Sitaker (kragen@pobox.com)
Date: Fri May 19 2000 - 10:40:21 PDT


Gavin Thomas Nicol writes:
> > Implementing a single message type for a single platform (as above) is
> > obviously much simpler than writing an XML parser. Implementing a
> > single message type portably --- which requires byteswapping,
> > correcting for data type sizes, etc. --- is an order of magnitude or
> > two harder, but still much easier than writing an XML parser.
>
> The question is though, is it easier/simpler to implement
>
> void call(int method, int argument)
> {
> int f = connect(....);
> putint(method);
> putint(method);
> }
>
> using a put/get that uses a plaintext format or one that uses
> a 32 bit long on the wire (4 bytes).
>
> I would argue that parsing 4 bytes is probably less code, especially
> given the large number of libraries for dealing with this
> (like how hard is htonl and ntohl?).

Granted. But if CORBA solves more problems than XML-RPC does, this
surely solves many fewer.

I like your previous suggestion of XDR as the efficient binary
representation most closely analogous to XML (in its role in XML-RPC).
How big is the code implementing XDR? (It includes something analogous
to an IDL compiler, doesn't it?)

XML is not the Ultima Thule spoken of in ancient parsing legends,
though; you could go with s-expressions (in the text realm) or nested
netstrings (in the semi-text realm) if ease of parsing is your first
criterion. netstrings (and binary representations in general) have the
distinct advantage that you don't have to parse *everything* to look at
*anything*.

(All this is completely unconcerned with things like debuggability,
discoverability, and conciseness of spec.)

> Of course, dealing with text on the wire in a portable manner
> might also be fun. How about dealing with machines with
> 6 bit bytes for example.

Fortunately, that's done for you if the wire in question is an Internet
wire. All the Internet protocols are defined in terms of octets ---
eight-bit units.

-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
The power didn't go out on 2000-01-01 either.  :)


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Fri May 19 2000 - 10:42:35 PDT