From: Tomasz Wegrzanowski Date: 2006-08-06T02:35:10+09:00 Subject: Re: magic/xml library for easy XML processing On 8/5/06, Adam Keys wrote: > This looks really promising. You almost lost me though. I suspected > from the mention of XML::Twig that magic/xml might handle Really Huge > XML (TM) more gracefully than our current options and it looks like > it does. Point being, you should mention it handles Really Huge XML > gracefully up front, as that is something I find myself inflicting > ugly hacks upon myself to achieve today. > [...] > > This library looks really good. I'm going to keep it in mind for all > my "some idiot sent me an 1 GB XML file that is a bunch of smaller > files concatenated together" needs. Handling huge XML files is just a bonus. The main reason the library exists is its sheer expressive power. I tried to recode W3C's XQuery Use Cases ( http://www.w3.org/TR/xquery-use-cases/ ) in magic/xml to see how it compares with XQuery on XQuery's terms, and they're very close. For the use cases I translated so far the results are (characters with whitespace merged and a few other transformations that make it more meaningful): Problem XMP 1: Ruby 187 (114%), XQuery: 164 Problem XMP 2: Ruby 132 (100%), XQuery: 132 Problem XMP 3: Ruby 115 (103%), XQuery: 112 Problem XMP 4: Ruby 400 (101%), XQuery: 398 Problem XMP 5: Ruby 367 (124%), XQuery: 296 Problem XMP 6: Ruby 220 (104%), XQuery: 211 Problem XMP 7: Ruby 232 (135%), XQuery: 172 Problem XMP 8: Ruby 150 (88%), XQuery: 170 Problem XMP 9: Ruby 157 (129%), XQuery: 122 Problem XMP 10: Ruby 298 (142%), XQuery: 210 Problem XMP 11: Ruby 295 (136%), XQuery: 217 Problem XMP 12: Ruby 457 (118%), XQuery: 387 Problem Tree 1: Ruby 166 (61%), XQuery: 270 Problem Tree 2: Ruby 118 (109%), XQuery: 108 Problem Tree 3: Ruby 133 (101%), XQuery: 132 Problem Tree 4: Ruby 75 (93%), XQuery: 81 Problem Tree 5: Ruby 168 (104%), XQuery: 161 Problem Tree 6: Ruby 255 (69%), XQuery: 369 Total: Ruby 3925 (106%), XQuery: 3712 Median ratio: 104% I don't think any other Ruby library for XML can get anywhere close to such results. And efficient processing of large XMLs ? That's just a small freebie :-D -- Tomasz Wegrzanowski [ http://t-a-w.blogspot.com/ ]