Hi,

The example file BaseXClient uses an unbuffered stream to write to the socket:

  out = socket.getOutputStream();
 
  void send(final String s) throws IOException {
    for(final byte t : s.getBytes()) out.write(t);
    out.write(0);
  }

This yields extremely bad performance, especially for large queries (every single call to write will trigger a separate system call to the OS, which in turn will trigger a separate TCP segment on the wire). On a typical Ethernet, this means that 100 minimum sized packets are transmitted rather than a single packet to transmit a 100-byte query.

On a different note, why is BaseXClient not part of the "official" BaseX API, or at least provided as part of the distributed .jar files in an org.basex.* package?

 - Godmar