I'm working on a Java utility that generates a bunch of XML documents matching a specific DTD usi开发者_运维问答ng 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.
精彩评论