Re: [xml] speed between XPath & SAX & xmlReader



Hi,

On Mon, 2005-10-24 at 13:28 +0200, nico wrote:
hi,
i didn't know that 100 nodes are peanuts.
thanks for that point.

I get the following times for an example document
with 100 nodes and xmllint's default parsing which
includes deallocation:

real    0m0.003s
user    0m0.002s
sys     0m0.001s

kbu librax:/data/home/kbuchcik/gnomecvs$ head result.xml
<?xml version="1.0"?>
<test>
  <x0>Joni M. - 100</x0>
  <x1>Joni M. - 99</x1>
  <x2>Joni M. - 98</x2>
  <x3>Joni M. - 97</x3>
  <x4>Joni M. - 96</x4>
  <x5>Joni M. - 95</x5>
  <x6>Joni M. - 94</x6>
  <x7>Joni M. - 93</x7>

kbu librax:/data/home/kbuchcik/gnomecvs$ time xmllint --noout result.xml

real    0m0.003s
user    0m0.002s
sys     0m0.001s

kbu librax:/data/home/kbuchcik/gnomecvs$ xmllint --noout --timing
result.xml
Parsing took 0 ms
Freeing took 0 ms

kbu librax:/data/home/kbuchcik/gnomecvs$ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 3
model name      : Intel(R) Pentium(R) 4 CPU 2.80GHz
stepping        : 4
cpu MHz         : 2815.216
cache size      : 1024 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 3
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe pni
monitor ds_cpl cid
bogomips        : 5570.56



best regards
nicolas

Nico, IMHO I wouldn't bother using SAX2, first it might
get oversized (in terms of your code) for what you want
and second: 100 nodes of the kind in your example are
peanuts for Libxml2. So maybe you want just to consider the
xmlReader if you want less memory impact, and if memory is
not so important (and 100 nodes shouldn't, except if you run
this many times asynchronously) then just parse it into a
tree and navigate through it; I wouldn't use XPath in the
latter case, since the structure seems easy to navigate.

Regards,

Kasimier


Regards,

Kasimier



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]