Python - 3.6.15:
- xmltodict - 0.12.0
- lxml - 4.7.1
Rust - 1.57.0
- pyo3 - 0.15.1
- quick-xml - 0.22.0
- serde - 1.0.136
Структура XML-файла:
<data>
<person>
<address>8450 Reid Orchard Apt. 815</address>
<age>76</age>
<amount>45826</amount>
<city>East Linda</city>
<country>IS</country>
<credit_card_number>4926698773041235</credit_card_number>
<currency>ZWD</currency>
<date>1993-07-22</date>
<email>[email protected]</email>
<job>Personal assistant</job>
<male>False</male>
<name>Daniel Pennington</name>
<phone_number>6641446731</phone_number>
<postcode>55819</postcode>
<quantity>1222</quantity>
<site>web-60.campbell.info</site>
</person>
<person>
...
</person>
<data>
Результат преобразования в Python-объект:
[
{
'name': 'Daniel Pennington',
'city': 'East Linda',
'address': '8450 Reid Orchard Apt. 815',
'email': '[email protected]',
'country': 'IS',
'credit_card_number': 4926698773041235,
'currency': 'ZWD',
'site': 'web-60.campbell.info',
'job': 'Personal assistant',
'postcode': 55819,
'phone_number': '6641446731',
'male': False,
'amount': 45826,
'quantity': 1222,
'age': 76,
'date': '1993-07-22'
},
{
...
}
]
Library | Language | 60Kb | 120Kb | 300Kb | 600Kb | 1.2Mb | 3.2Mb | 9Mb | 30Mb | 60Mb |
---|---|---|---|---|---|---|---|---|---|---|
xmltodict | Python | 99.4ms | 104.1ms | 144.0ms | 194.3 ms | 311.9ms | 679.2ms | 1809.6s | 6.040s | 11.817s |
lxml | Cython | 56.8ms | 58.8ms | 70.7ms | 86.1ms | 123.1ms | 235.5ms | 615.1ms | 1.815s | 3.529s |
pyo3 quick-xml | Rust | 36.4ms | 37.5ms | 51.4ms | 55.4ms | 79.9ms | 149.9ms | 365.7ms | 1.161s | 2.304s |