#14 ElementTree / cElementTree support

Improvement
open
Core (6)
5
2006-10-16
2006-10-16
Jan Strube
No

When processing Clouds, I noticed that the memory usage
get quite large. I have therefore looked at
cElementTree as an alternative XML processor, because I
have heard good things and because it is part of
standard python2.5

ElementTree is (allegedly) pure python, while
cElementTree uses C code under the hood. The API is the
same for both, so changing between the Python and the C
version means simply changing the include.

Attached you find a very simple test that can read an
AIDA file that contains IHistogram1D objects. (I hope
it does the processing correctly)
I have not yet made any benchmarking, as I expect the
real difference to be in large IClouds and ITuples.

In order not to introduce any bugs, I would like to
know if you have any unit tests that I could use. (Or
if you would like to perorm the unit test, if you think
this is useful)

If you think this makes sense, I would try and re-write
ITree.py to use (c)elementTree.

Cheers,
Jan

Discussion

  • Jan Strube
    Jan Strube
    2006-10-16

    elementTree AIDA processor

     
    Attachments
  • Koji Kishimoto
    Koji Kishimoto
    2006-10-16

    • labels: --> Core
    • milestone: --> Improvement
    • assigned_to: nobody --> korry
     
  • Koji Kishimoto
    Koji Kishimoto
    2006-10-16

    Logged In: YES
    user_id=734761

    Great!
    I agree with the replacement to the cElementTree module
    (xml.etree.cElementTree) because of its processing speed,
    and memory usage. In addition, as long as being a standard
    Python module, I think there's no problem if it is
    implemented in C.

    I've not yet excuted the attached file for lacking Python2.5
    but have read all of the lines. It seems to be very nice and
    smart. (Note: tabs and spaces are mixed in the head of some
    lines. This might be the problem of your script editor...)

    There is no unit test for ITree.py currently but I think it
    is very useful, too. (Simple check script had been used.)

    Again, I agree with the idea of cElementTree. Please make
    Itree.py to be more elegant one. Thanks, Jan!