[Mono-list] XML File Opening, XPathNodeIterator 3500% Slower in Mono/Linux

Bradford Stephens bradfordstephens at gmail.com
Thu Jul 17 19:04:50 EDT 2008


I've recently convinced my company to switch for MS-only to a Linux
Cluster for our core business system (yay!). Part of this system
involves turning HTML to valid XML, then processing it with XPaths.

As part of this process, I open and load 300 XML files. This operation
takes about 20 milliseconds in Windows to open the files, parse the
XML, and load some data into HashTables. However. it takes about 1700
milliseconds on Mono with Linux (Ubuntu Server Edition).

I also need to parse HTML documents that have been transformed with
XML using XPath. I've narrowed the bottleneck to
XPathNodeIterator.MoveNext(). On my Windows system, 90% of these calls
take 0-6 milliseconds, with 10% of calls taking up to 40. However, on
the same file in Mono, each call takes at least 60-115 milliseconds.
This adds up rapidly when I need to do 50+ calls per document, and
tens of thousands of documents.

This does not happen with *all* documents that I'm parsing -- some
take 10 milliseconds to parse, and others can take 2200ms. However,
documents that are slower in Linux are also slower in Windows.

Am I missing some optimizations here? I compile in MonoDevelop with
the optimizations flag "on", then run the .exe from the command line
"Parser.exe". I also tried "mono -O=all Parser.exe".  I'm running mono
1.9.1 with the C# 2.0 profile. I make sure to compile in
"Release|AllCPU" mode as well.

I could post some example code, but the system is rather complex and
I'd have to take all our proprietary stuff out :)

Could I use Microsoft's System.Xml.Dll in place of the Mono one, if I
can't figure this out?

Thanks for your help in advance!


More information about the Mono-list mailing list