On 31 May 2010 10:20, Mike Caron <[email protected]> wrote:
> On 30/05/2010 6:01 PM, Ralph Versteegen wrote:
>>
>> On 31 May 2010 08:57, Mike Caron<[email protected]>  wrote:
>>>
>>> D:\ohrrpgce>dir gentest.xml
>>> 30/05/2010  04:52 AM       237,804,960 gentest.xml
>>>
>>> D:\ohrrpgce>xml2reload gentest.xml gentest.rld
>>> Loaded XML document in 20857 ms
>>> Memory usage: 301
>>> Parsed XML document in 17049 ms
>>> Memory usage: 573142499
>>> Freed XML document in 35378 ms
>>> Optimised document in 31149 ms
>>> Memory usage: 428328275
>>> Serialized document in 8557 ms
>>> Tore down memory in 173 ms
>>> Finished in 116510 ms
>>>
>>> D:\ohrrpgce>dir gentest.rld
>>> 30/05/2010  04:31 PM       203,271,865 gentest.rld
>>>
>>> And, here's a profile of CPU and Memory usage while doing the above:
>>>
>>> http://taleotc.com/Reloadprofile.png
>>>
>>> Note that on the CPU graph, Green is Usermode, while Red is Kernel mode.
>>> And
>>> that my CPU thinks it's dual core, so you should consider the 50% mark to
>>> be
>>> "max".
>>
>> Hyperthreading?
>
> Aka, "Make applications think the CPU can multiple things at once, when in
> reality it can't!". I guess "Hyperthreading" is more marketable, though. :)
>
>>> Further, you should care more about the "Commit" memory, rather than th
>>> "Physical" memory.
>>> --
>>> Mike
>>
>> Yikes! Nearly twice as long to free as to load the XML document. Looks
>> like the memory allocator thrashed a lot while freeing memory, which
>> is odd because I would have expected xml nodes to be deleted in about
>> the same order they were created. Maybe libxml deletes attribute nodes
>> after deleting children. (Yes! I checked, and my hunch is correct!)
>>
>> I assume that 3.0GB marks the total virtual memory committed on the
>> machine, and xml2relaod used roughly 1.5GB?
>
> Yes, that's correct.
>
>> What does that xml file look like? It's interesting that the resulting
>> .reld is nearly the same size as the original! That 64MB test case
>> compressed to half the size.
>
> I used this program to generate a document:
>
> http://www.xml-benchmark.org/downloads.html
>
> It seems to have a lot of content in the form of text nodes. Alas, I can't
> find the place I got the original document, since it was basically more of
> the same.
>
> I suppose we could just cat the 64-meg document to itself, and do a tiny bit
> of editing :D
>
>> Serialisation could be a bit faster (you can always increase the
>> buffer size to speed it up, going from 32kb to 64kb caused about a 20%
>> improvement), but mostly I'm happy with that.
>
> Honestly, that's the least of my concerns. That's always going to scale
> linearly with the resulting document size.
>
> I'm more concerned, now, with the thing we haven't really been profiling:
> Loading these stupidly large documents again. I modified reloadtest to load
> it, and it ain't pretty:

Well, I told you to profile them, and have been doing so myself; who
cares how long it takes to convert an XML?

And speaking of profiling, I tried profiling but got totally useless
results missing nearly all running time.

> Test #19: loadHugeDocument... Pass
> Took 50 s
> Test #20: freeHugeDocument... Pass
> Took 297 ms
>
> And, just for completion's sake, here's the 64 Meg-document's RELOAD:
>
> Test #19: loadHugeDocument... Pass
> Took 19 s
> Test #20: freeHugeDocument... Pass
> Took 53 ms
>
> Ouch.

What the devil? Here are my times, after warming up of course, on
windows XP this time, with a private heap:

> reload2reload medline.reld medline2.reld
Loaded document in 12743 ms
Serialized document in 1062 ms
Tore down memory in 17 ms
Finished in 13824 ms

But!!!!! here's what it was in linux (back then the buffer was
smaller, I think now the serialization time is about 2.5s):

bash-3.1$ time reload2reload medline2.reld medline2_.reld
Loaded document in 3724 ms
Serialized document in 3506 ms
Tore down memory in 597 ms
Finished in 7838 ms

real    0m7.892s
user    0m5.276s
sys     0m0.440s

So, it looks like Linux is being way too paranoid about flushing the
file to disk as its written, or something like that (there are so many
options in the kernel for tuning file systems; looks like they're not
set for performance in this case on my machine), and conversely
Windows is doing something REALLY stupid when loading it in. I mean,
the reload file is read in a linear manner, what on earth could the
problem be? Argh! We may have to write a file buffering layer for
reading files as well! Or maybe the problem is in allocating nodes?
We could test this by loading the file into memory before attempting
to load it.

Also, on Linux it took less than half as long to delete the document
as it does in Windows without a private heap.

> One thing I want to implement is allocating memory for multiple nodes at
> once. This will be tricky, though, since deleting nodes is a problem. Hmm...
> I will give this some thought...

I don't think that's really necessary (unless the memory allocation
really is the bottleneck) and would be pretty damn messy.

> --
> Mike
> _______________________________________________
> Ohrrpgce mailing list
> [email protected]
> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
>
_______________________________________________
Ohrrpgce mailing list
[email protected]
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org

Reply via email to