[Mono-list] XML / XPaths Very Slow Compared to MS C#

Bradford Stephens bradfordstephens at gmail.com
Tue Sep 9 20:26:10 EDT 2008


Hello all,

It seems that XPath selection is several orders of magnitude slower in
Mono 2.0 on Ubuntu than on C# on Windows XP.

The example below is pretty straightforward, and doesn't seem like
it's much slower, but we do this millions of times a day. In some
cases, I've seen parsing a document go from 10 ms on Windows to over
2000 ms on Mono 2.0/Linux.

I've made a Mono Project to let you test it yourselves:
http://www.giborama.com/TestSlowXML.tar

I've advocated the switch of our company's platform from Windows to
Linux, but XML/XPath is an essential part of the business, and with it
being so slow, we're dead in the water.

I would greatly appreciate any help you may have :)

~~~~

Windows XP / C# 2005:

Xpath: //head/title took 2
Xpath: //div[@id= 'content']/div[starts-with (@id, 'p')] took 0
Xpath: .//h2/a took 0
Xpath: .//p[@class= 'byline']/a[position()=1] took 0
Xpath: .//p[@class= 'byline'] took 1
Xpath: .//h2 took 0
Xpath: .//div[@class= 'post']/div[starts-with (@id, 'pc')] took 0
Xpath: .//div[@class= 'post']/div[starts-with (@id, 'pc')]//img took 0
Xpath: .//div[@class= 'post']/div[starts-with (@id, 'pc')]//a took 0
Xpath: //p[@class= 'paging']/a[@class= 'alignright arrowforward'] took 0


Ubuntu / Mono 2.0:

Xpath: //head/title took 24
Xpath: //div[@id= 'content']/div[starts-with (@id, 'p')] took 8
Xpath: .//h2/a took 1
Xpath: .//p[@class= 'byline']/a[position()=1] took 5
Xpath: .//p[@class= 'byline'] took 3
Xpath: .//h2 took 1
Xpath: .//div[@class= 'post']/div[starts-with (@id, 'pc')] took 5
Xpath: .//div[@class= 'post']/div[starts-with (@id, 'pc')]//img took 5
Xpath: .//div[@class= 'post']/div[starts-with (@id, 'pc')]//a took 5
Xpath: //p[@class= 'paging']/a[@class= 'alignright arrowforward'] took 8

Cheers,
Bradford


More information about the Mono-list mailing list