Hi Vinnie, Vinnie Falco wrote:
I've been working on a massively-multiplayer online blackjack casino server, called Beast Lounge [1]. The server and client communicate using JSON-RPC over WebSocket. I have developed a brand-new JSON library for this project, in accordance with the following design goals:
I am reminded of the various discussions of alternative styles of XML parsers that have happened on this list over the years. People have a surprising variety of often-conflicting requirements or preferences. I think it's unlikely that any one solution will suit everyone - but maybe there are common bits of functionality that can be shared? My preference has always been for parsing by memory-mapping the entire file, or equivalently reading the entire document into memory as a blob of text, and then providing iterators that advance through the text looking for the next element, attribute, character etc. I think one of the first XML parsers to work this way was RapidXML. Their aim was to get the parsing speed as close to strlen() as possible and they did pretty well. Others have mentioned some benchmarks and I encourage you to try them - and/or at least be clear about whether performance is a design goal. Regards, Phil.