简体   繁体   中英

What is the fastest way to generate lots of XML data?

I'm working on a Java utility that generates a bunch of XML documents matching a specific DTD using slightly randomized layout generation (so, for example, the document might look like <a><b><c /></b></a> or it might look like <a><b/><b><c>text</c></b></a> .

Right now, I've gotten it to the point where I can generate roughly 32,000 documents per second (storing the files in /dev/shm/), and I feel like that's pretty good, but it leaves me wondering if maybe I could do it faster in C++ or maybe some other language with super-fast XML generation. Any contenders?

As for speed probably not. You are most likely bound by hard disk speed at that point. Be sure you are using a buffered class to write to the disk, but otherwise I don't know if it'll get a lot faster.

You could run different threads/instances if you had two hard drives--but writing 2 streams to one drive only slows things down.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM