Given a large array of numbers where:
[1, 2, 3, 4 ...] => <tag attrib="1" />
<tag attrib="2" />
<tag attrib="3" />
<tag attrib="4" />
...
Which is more efficient/fast:
a) building them from scratch using Element("name", attributes) and appending them to some root
or
b) fromstring(str) where str is the string representation of those tags in the example
updated test:
The cElementTree is the fastest version. So i would say: don’t use the string abomination! 😉