We have recently replaced binary based communication protocol with XML one (between browser based client and server). The implementation is almost complete, however I am looking for ways to improve its performance both for faster transmission and parsing. Any ideas ? Please post link along with the answer.
I presume this is a web service and using C++ as a mod extenstions to a web server rather than writing your own.
To speed up transfer you could be able to enable gzip compression on the web server, this is relatively straight forward in all modern web servers.
Parsing could be sped up by:
- Reducing node count - can the data being set be reduced, can some be inferred from others?
- If you are using a DTD/XSD, have a local copy and resolve to this rather than necessarily always pulling it from the public location. I have seen an XML library pull it from the public location each time which slowed down parsing considerably.
- Were I you, I'd avoid premature optimization, and just make sure The Damn Thing Works when deployed to your users. You can optimize later if it's an issue.
- Binary for text is an engineering tradeoff. You gave up performance to get portability and human-readableness. Equivalent Exchange and all that. You could just accept the engineering tradeoff and move on to other things.
- Keep the binary fat-client implementation around to satisfy the few people who do complain about performance. And when they complain, tell 'em to use the client.
- As a last resort, kill all whitespace between tags and shorten tag names. Use default namespaces to avoid extraneous prefixes.