From 12838f42c27af52a3cf977a6dfb7f19b33099fdb Mon Sep 17 00:00:00 2001 From: justold <1188067+pwwang@users.noreply.github.com> Date: Thu, 21 Sep 2023 16:17:00 +0000 Subject: [PATCH] Fix #5 --- README.md | 72 +++++++++++++++--------------- README.raw.md | 2 +- reports/with_toml-test_latest.md | 70 ++++++++++++++--------------- reports/with_toml-test_v1.0.0.md | 76 ++++++++++++++++---------------- reports/with_toml-test_v1.1.0.md | 76 ++++++++++++++++---------------- reports/with_toml-test_v1.2.0.md | 74 +++++++++++++++---------------- toml_bench/cases/hetero_array.py | 18 ++++++-- 7 files changed, 199 insertions(+), 189 deletions(-) diff --git a/README.md b/README.md index efcf030..ef5cb8a 100644 --- a/README.md +++ b/README.md @@ -94,12 +94,12 @@ Literally `.dumps({"v": [1, 1.2, True, "string"]})` | |Dumped value or error| |-|-----------------------| -|toml|v = [ 1, 1.2, true, "string",]
| -|tomli/tomli_w|v = [
1,
1.2,
true,
"string",
]
| -|tomlkit|v = [1, 1.2, true, "string"]
| -|pytomlpp|v = [ 1, 1.2, 1, 'string' ]| -|rtoml|v = [1, 1.2, true, "string"]
| -|qtoml|v = [1, 1.2, true, 'string']
| +|toml|v = \[ 1, 1.2, true, "string",\]
| +|tomli/tomli_w|v = \[
    1,
    1.2,
    true,
    "string",
\]
| +|tomlkit|v = \[1, 1.2, true, "string"\]
| +|pytomlpp|v = \[ 1, 1.2, 1, 'string' \]| +|rtoml|v = \[1, 1.2, true, "string"\]
| +|qtoml|v = \[1, 1.2, true, 'string'\]
| ### Loading a heterogenous array @@ -111,11 +111,11 @@ Literally `.loads('v = [1, 1.2, True, "string"]')` | |Loaded as| |-|-----------------------| |toml|Not a homogeneous array (line 2 column 1 char 1)| -|tomli/tomli_w|{'v': [1, 1.2, True, 'string']}| -|tomlkit|{'v': [1, 1.2, True, 'string']}| -|pytomlpp|{'v': [1, 1.2, True, 'string']}| -|rtoml|{'v': [1, 1.2, True, 'string']}| -|qtoml|{'v': [1, 1.2, True, 'string']}| +|tomli/tomli_w|`{'v': [1, 1.2, True, 'string']}`| +|tomlkit|`{'v': [1, 1.2, True, 'string']}`| +|pytomlpp|`{'v': [1, 1.2, True, 'string']}`| +|rtoml|`{'v': [1, 1.2, True, 'string']}`| +|qtoml|`{'v': [1, 1.2, True, 'string']}`| ### Dumping a nested array @@ -126,12 +126,12 @@ Literally `.dumps({"v": [[1], [1, 2]]})` | |Dumped value or error| |-|-----------------------| -|toml|
v = [ [ 1,], [ 1, 2,],]
| -|tomli/tomli_w|
v = [
[
1,
],
[
1,
2,
],
]
| -|tomlkit|
v = [[1], [1, 2]]
| -|pytomlpp|
v = [ [ 1 ], [ 1, 2 ] ]
| -|rtoml|
v = [[1], [1, 2]]
| -|qtoml|
v = [[1], [1, 2]]
| +|toml|v = \[ \[ 1,\], \[ 1, 2,\],\]
| +|tomli/tomli_w|v = \[
    \[
        1,
    \],
    \[
        1,
        2,
    \],
\]
| +|tomlkit|v = \[\[1\], \[1, 2\]\]
| +|pytomlpp|v = \[ \[ 1 \], \[ 1, 2 \] \]| +|rtoml|v = \[\[1\], \[1, 2\]\]
| +|qtoml|v = \[\[1\], \[1, 2\]\]
| ### Loading a nested array @@ -142,12 +142,12 @@ Literally `.loads('v = [[1], [1, 2]]')` | |Loaded as| |-|-----------------------| -|toml|{'v': [[1], [1, 2]]}| -|tomli/tomli_w|{'v': [[1], [1, 2]]}| -|tomlkit|{'v': [[1], [1, 2]]}| -|pytomlpp|{'v': [[1], [1, 2]]}| -|rtoml|{'v': [[1], [1, 2]]}| -|qtoml|{'v': [[1], [1, 2]]}| +|toml|`{'v': [[1], [1, 2]]}`| +|tomli/tomli_w|`{'v': [[1], [1, 2]]}`| +|tomlkit|`{'v': [[1], [1, 2]]}`| +|pytomlpp|`{'v': [[1], [1, 2]]}`| +|rtoml|`{'v': [[1], [1, 2]]}`| +|qtoml|`{'v': [[1], [1, 2]]}`| ### Dumping keeps order of keys? @@ -320,11 +320,11 @@ using data provided by `pytomlpp` | |Loading speed|Dumping speed| |-|-|-| |toml|Excluded (heterogeneous arrays not supported)|Excluded (heterogeneous arrays not supported)| -|tomli/tomli_w|7.44s (1000 iterations)|3.69s (1000 iterations)| -|tomlkit|136.86s (1000 iterations)|2.54s (1000 iterations)| -|pytomlpp|1.37s (1000 iterations)|0.96s (1000 iterations)| +|tomli/tomli_w|7.55s (1000 iterations)|3.11s (1000 iterations)| +|tomlkit|150.98s (1000 iterations)|2.14s (1000 iterations)| +|pytomlpp|1.41s (1000 iterations)|0.98s (1000 iterations)| |rtoml|0.98s (1000 iterations)|values must be emitted before tables| -|qtoml|19.28s (1000 iterations)|5.15s (1000 iterations)| +|qtoml|18.39s (1000 iterations)|4.75s (1000 iterations)| ### Running speed with data provided by `rtoml` @@ -337,11 +337,11 @@ provided by `rtoml` | |Loading speed|Dumping speed| |-|-|-| |toml|Excluded (heterogeneous arrays not supported)|Excluded (heterogeneous arrays not supported)| -|tomli/tomli_w|1.80s (1000 iterations)|0.68s (1000 iterations)| -|tomlkit|30.51s (1000 iterations)|0.82s (1000 iterations)| +|tomli/tomli_w|1.56s (1000 iterations)|0.55s (1000 iterations)| +|tomlkit|29.90s (1000 iterations)|0.75s (1000 iterations)| |pytomlpp|0.24s (1000 iterations)|0.19s (1000 iterations)| |rtoml|0.19s (1000 iterations)|0.05s (1000 iterations)| -|qtoml|4.62s (1000 iterations)|1.32s (1000 iterations)| +|qtoml|4.57s (1000 iterations)|1.26s (1000 iterations)| ### Running speed with data provided by `tomli` @@ -354,11 +354,11 @@ provided by `tomli` | |Loading speed|Dumping speed| |-|-|-| |toml|Excluded (heterogeneous arrays not supported)|Excluded (heterogeneous arrays not supported)| -|tomli/tomli_w|1.17s (1000 iterations)|0.38s (1000 iterations)| -|tomlkit|18.75s (1000 iterations)|0.40s (1000 iterations)| -|pytomlpp|0.24s (1000 iterations)|0.15s (1000 iterations)| -|rtoml|0.16s (1000 iterations)|0.11s (1000 iterations)| -|qtoml|3.72s (1000 iterations)|0.94s (1000 iterations)| +|tomli/tomli_w|1.11s (1000 iterations)|0.38s (1000 iterations)| +|tomlkit|19.39s (1000 iterations)|0.37s (1000 iterations)| +|pytomlpp|0.25s (1000 iterations)|0.18s (1000 iterations)| +|rtoml|0.20s (1000 iterations)|0.11s (1000 iterations)| +|qtoml|3.61s (1000 iterations)|0.94s (1000 iterations)| @@ -404,7 +404,7 @@ toml-bench --comver 1.0.0 #### Use a different number of iterations in speed tests ```shell -toml-bench --iter 1000 +toml-bench --iter 5000 ``` #### Test with different versions of packages diff --git a/README.raw.md b/README.raw.md index 375ef76..2d04b81 100644 --- a/README.raw.md +++ b/README.raw.md @@ -50,7 +50,7 @@ toml-bench --comver 1.0.0 #### Use a different number of iterations in speed tests ```shell -toml-bench --iter 1000 +toml-bench --iter 5000 ``` #### Test with different versions of packages diff --git a/reports/with_toml-test_latest.md b/reports/with_toml-test_latest.md index 74f0b05..1b5b44d 100644 --- a/reports/with_toml-test_latest.md +++ b/reports/with_toml-test_latest.md @@ -86,12 +86,12 @@ Literally `.dumps({"v": [1, 1.2, True, "string"]})` | |Dumped value or error| |-|-----------------------| -|toml|v = [ 1, 1.2, true, "string",]
| -|tomli/tomli_w|v = [
1,
1.2,
true,
"string",
]
| -|tomlkit|v = [1, 1.2, true, "string"]
| -|pytomlpp|v = [ 1, 1.2, 1, 'string' ]| -|rtoml|v = [1, 1.2, true, "string"]
| -|qtoml|v = [1, 1.2, true, 'string']
| +|toml|v = \[ 1, 1.2, true, "string",\]
| +|tomli/tomli_w|v = \[
    1,
    1.2,
    true,
    "string",
\]
| +|tomlkit|v = \[1, 1.2, true, "string"\]
| +|pytomlpp|v = \[ 1, 1.2, 1, 'string' \]| +|rtoml|v = \[1, 1.2, true, "string"\]
| +|qtoml|v = \[1, 1.2, true, 'string'\]
| ## Loading a heterogenous array @@ -103,11 +103,11 @@ Literally `.loads('v = [1, 1.2, True, "string"]')` | |Loaded as| |-|-----------------------| |toml|Not a homogeneous array (line 2 column 1 char 1)| -|tomli/tomli_w|{'v': [1, 1.2, True, 'string']}| -|tomlkit|{'v': [1, 1.2, True, 'string']}| -|pytomlpp|{'v': [1, 1.2, True, 'string']}| -|rtoml|{'v': [1, 1.2, True, 'string']}| -|qtoml|{'v': [1, 1.2, True, 'string']}| +|tomli/tomli_w|`{'v': [1, 1.2, True, 'string']}`| +|tomlkit|`{'v': [1, 1.2, True, 'string']}`| +|pytomlpp|`{'v': [1, 1.2, True, 'string']}`| +|rtoml|`{'v': [1, 1.2, True, 'string']}`| +|qtoml|`{'v': [1, 1.2, True, 'string']}`| ## Dumping a nested array @@ -118,12 +118,12 @@ Literally `.dumps({"v": [[1], [1, 2]]})` | |Dumped value or error| |-|-----------------------| -|toml|
v = [ [ 1,], [ 1, 2,],]
| -|tomli/tomli_w|
v = [
[
1,
],
[
1,
2,
],
]
| -|tomlkit|
v = [[1], [1, 2]]
| -|pytomlpp|
v = [ [ 1 ], [ 1, 2 ] ]
| -|rtoml|
v = [[1], [1, 2]]
| -|qtoml|
v = [[1], [1, 2]]
| +|toml|v = \[ \[ 1,\], \[ 1, 2,\],\]
| +|tomli/tomli_w|v = \[
    \[
        1,
    \],
    \[
        1,
        2,
    \],
\]
| +|tomlkit|v = \[\[1\], \[1, 2\]\]
| +|pytomlpp|v = \[ \[ 1 \], \[ 1, 2 \] \]| +|rtoml|v = \[\[1\], \[1, 2\]\]
| +|qtoml|v = \[\[1\], \[1, 2\]\]
| ## Loading a nested array @@ -134,12 +134,12 @@ Literally `.loads('v = [[1], [1, 2]]')` | |Loaded as| |-|-----------------------| -|toml|{'v': [[1], [1, 2]]}| -|tomli/tomli_w|{'v': [[1], [1, 2]]}| -|tomlkit|{'v': [[1], [1, 2]]}| -|pytomlpp|{'v': [[1], [1, 2]]}| -|rtoml|{'v': [[1], [1, 2]]}| -|qtoml|{'v': [[1], [1, 2]]}| +|toml|`{'v': [[1], [1, 2]]}`| +|tomli/tomli_w|`{'v': [[1], [1, 2]]}`| +|tomlkit|`{'v': [[1], [1, 2]]}`| +|pytomlpp|`{'v': [[1], [1, 2]]}`| +|rtoml|`{'v': [[1], [1, 2]]}`| +|qtoml|`{'v': [[1], [1, 2]]}`| ## Dumping keeps order of keys? @@ -312,11 +312,11 @@ using data provided by `pytomlpp` | |Loading speed|Dumping speed| |-|-|-| |toml|Excluded (heterogeneous arrays not supported)|Excluded (heterogeneous arrays not supported)| -|tomli/tomli_w|7.44s (1000 iterations)|3.69s (1000 iterations)| -|tomlkit|136.86s (1000 iterations)|2.54s (1000 iterations)| -|pytomlpp|1.37s (1000 iterations)|0.96s (1000 iterations)| +|tomli/tomli_w|7.55s (1000 iterations)|3.11s (1000 iterations)| +|tomlkit|150.98s (1000 iterations)|2.14s (1000 iterations)| +|pytomlpp|1.41s (1000 iterations)|0.98s (1000 iterations)| |rtoml|0.98s (1000 iterations)|values must be emitted before tables| -|qtoml|19.28s (1000 iterations)|5.15s (1000 iterations)| +|qtoml|18.39s (1000 iterations)|4.75s (1000 iterations)| ## Running speed with data provided by `rtoml` @@ -329,11 +329,11 @@ provided by `rtoml` | |Loading speed|Dumping speed| |-|-|-| |toml|Excluded (heterogeneous arrays not supported)|Excluded (heterogeneous arrays not supported)| -|tomli/tomli_w|1.80s (1000 iterations)|0.68s (1000 iterations)| -|tomlkit|30.51s (1000 iterations)|0.82s (1000 iterations)| +|tomli/tomli_w|1.56s (1000 iterations)|0.55s (1000 iterations)| +|tomlkit|29.90s (1000 iterations)|0.75s (1000 iterations)| |pytomlpp|0.24s (1000 iterations)|0.19s (1000 iterations)| |rtoml|0.19s (1000 iterations)|0.05s (1000 iterations)| -|qtoml|4.62s (1000 iterations)|1.32s (1000 iterations)| +|qtoml|4.57s (1000 iterations)|1.26s (1000 iterations)| ## Running speed with data provided by `tomli` @@ -346,9 +346,9 @@ provided by `tomli` | |Loading speed|Dumping speed| |-|-|-| |toml|Excluded (heterogeneous arrays not supported)|Excluded (heterogeneous arrays not supported)| -|tomli/tomli_w|1.17s (1000 iterations)|0.38s (1000 iterations)| -|tomlkit|18.75s (1000 iterations)|0.40s (1000 iterations)| -|pytomlpp|0.24s (1000 iterations)|0.15s (1000 iterations)| -|rtoml|0.16s (1000 iterations)|0.11s (1000 iterations)| -|qtoml|3.72s (1000 iterations)|0.94s (1000 iterations)| +|tomli/tomli_w|1.11s (1000 iterations)|0.38s (1000 iterations)| +|tomlkit|19.39s (1000 iterations)|0.37s (1000 iterations)| +|pytomlpp|0.25s (1000 iterations)|0.18s (1000 iterations)| +|rtoml|0.20s (1000 iterations)|0.11s (1000 iterations)| +|qtoml|3.61s (1000 iterations)|0.94s (1000 iterations)| diff --git a/reports/with_toml-test_v1.0.0.md b/reports/with_toml-test_v1.0.0.md index 2223e6b..bfa945f 100644 --- a/reports/with_toml-test_v1.0.0.md +++ b/reports/with_toml-test_v1.0.0.md @@ -86,12 +86,12 @@ Literally `.dumps({"v": [1, 1.2, True, "string"]})` | |Dumped value or error| |-|-----------------------| -|toml|v = [ 1, 1.2, true, "string",]
| -|tomli/tomli_w|v = [
1,
1.2,
true,
"string",
]
| -|tomlkit|v = [1, 1.2, true, "string"]
| -|pytomlpp|v = [ 1, 1.2, 1, 'string' ]| -|rtoml|v = [1, 1.2, true, "string"]
| -|qtoml|v = [1, 1.2, true, 'string']
| +|toml|v = \[ 1, 1.2, true, "string",\]
| +|tomli/tomli_w|v = \[
    1,
    1.2,
    true,
    "string",
\]
| +|tomlkit|v = \[1, 1.2, true, "string"\]
| +|pytomlpp|v = \[ 1, 1.2, 1, 'string' \]| +|rtoml|v = \[1, 1.2, true, "string"\]
| +|qtoml|v = \[1, 1.2, true, 'string'\]
| ## Loading a heterogenous array @@ -103,11 +103,11 @@ Literally `.loads('v = [1, 1.2, True, "string"]')` | |Loaded as| |-|-----------------------| |toml|Not a homogeneous array (line 2 column 1 char 1)| -|tomli/tomli_w|{'v': [1, 1.2, True, 'string']}| -|tomlkit|{'v': [1, 1.2, True, 'string']}| -|pytomlpp|{'v': [1, 1.2, True, 'string']}| -|rtoml|{'v': [1, 1.2, True, 'string']}| -|qtoml|{'v': [1, 1.2, True, 'string']}| +|tomli/tomli_w|`{'v': [1, 1.2, True, 'string']}`| +|tomlkit|`{'v': [1, 1.2, True, 'string']}`| +|pytomlpp|`{'v': [1, 1.2, True, 'string']}`| +|rtoml|`{'v': [1, 1.2, True, 'string']}`| +|qtoml|`{'v': [1, 1.2, True, 'string']}`| ## Dumping a nested array @@ -118,12 +118,12 @@ Literally `.dumps({"v": [[1], [1, 2]]})` | |Dumped value or error| |-|-----------------------| -|toml|
v = [ [ 1,], [ 1, 2,],]
| -|tomli/tomli_w|
v = [
[
1,
],
[
1,
2,
],
]
| -|tomlkit|
v = [[1], [1, 2]]
| -|pytomlpp|
v = [ [ 1 ], [ 1, 2 ] ]
| -|rtoml|
v = [[1], [1, 2]]
| -|qtoml|
v = [[1], [1, 2]]
| +|toml|v = \[ \[ 1,\], \[ 1, 2,\],\]
| +|tomli/tomli_w|v = \[
    \[
        1,
    \],
    \[
        1,
        2,
    \],
\]
| +|tomlkit|v = \[\[1\], \[1, 2\]\]
| +|pytomlpp|v = \[ \[ 1 \], \[ 1, 2 \] \]| +|rtoml|v = \[\[1\], \[1, 2\]\]
| +|qtoml|v = \[\[1\], \[1, 2\]\]
| ## Loading a nested array @@ -134,12 +134,12 @@ Literally `.loads('v = [[1], [1, 2]]')` | |Loaded as| |-|-----------------------| -|toml|{'v': [[1], [1, 2]]}| -|tomli/tomli_w|{'v': [[1], [1, 2]]}| -|tomlkit|{'v': [[1], [1, 2]]}| -|pytomlpp|{'v': [[1], [1, 2]]}| -|rtoml|{'v': [[1], [1, 2]]}| -|qtoml|{'v': [[1], [1, 2]]}| +|toml|`{'v': [[1], [1, 2]]}`| +|tomli/tomli_w|`{'v': [[1], [1, 2]]}`| +|tomlkit|`{'v': [[1], [1, 2]]}`| +|pytomlpp|`{'v': [[1], [1, 2]]}`| +|rtoml|`{'v': [[1], [1, 2]]}`| +|qtoml|`{'v': [[1], [1, 2]]}`| ## Dumping keeps order of keys? @@ -312,11 +312,11 @@ using data provided by `pytomlpp` | |Loading speed|Dumping speed| |-|-|-| |toml|Excluded (heterogeneous arrays not supported)|Excluded (heterogeneous arrays not supported)| -|tomli/tomli_w|7.32s (1000 iterations)|3.29s (1000 iterations)| -|tomlkit|140.81s (1000 iterations)|2.40s (1000 iterations)| -|pytomlpp|1.41s (1000 iterations)|0.97s (1000 iterations)| -|rtoml|0.97s (1000 iterations)|values must be emitted before tables| -|qtoml|19.31s (1000 iterations)|4.92s (1000 iterations)| +|tomli/tomli_w|7.39s (1000 iterations)|3.16s (1000 iterations)| +|tomlkit|145.48s (1000 iterations)|2.69s (1000 iterations)| +|pytomlpp|1.58s (1000 iterations)|1.05s (1000 iterations)| +|rtoml|0.98s (1000 iterations)|values must be emitted before tables| +|qtoml|19.28s (1000 iterations)|4.84s (1000 iterations)| ## Running speed with data provided by `rtoml` @@ -329,11 +329,11 @@ provided by `rtoml` | |Loading speed|Dumping speed| |-|-|-| |toml|Excluded (heterogeneous arrays not supported)|Excluded (heterogeneous arrays not supported)| -|tomli/tomli_w|1.63s (1000 iterations)|0.57s (1000 iterations)| -|tomlkit|30.96s (1000 iterations)|0.79s (1000 iterations)| -|pytomlpp|0.24s (1000 iterations)|0.20s (1000 iterations)| -|rtoml|0.20s (1000 iterations)|0.05s (1000 iterations)| -|qtoml|4.59s (1000 iterations)|1.30s (1000 iterations)| +|tomli/tomli_w|1.60s (1000 iterations)|0.57s (1000 iterations)| +|tomlkit|32.29s (1000 iterations)|0.76s (1000 iterations)| +|pytomlpp|0.27s (1000 iterations)|0.20s (1000 iterations)| +|rtoml|0.19s (1000 iterations)|0.05s (1000 iterations)| +|qtoml|4.87s (1000 iterations)|1.31s (1000 iterations)| ## Running speed with data provided by `tomli` @@ -346,9 +346,9 @@ provided by `tomli` | |Loading speed|Dumping speed| |-|-|-| |toml|Excluded (heterogeneous arrays not supported)|Excluded (heterogeneous arrays not supported)| -|tomli/tomli_w|1.11s (1000 iterations)|0.38s (1000 iterations)| -|tomlkit|21.12s (1000 iterations)|0.39s (1000 iterations)| -|pytomlpp|0.25s (1000 iterations)|0.16s (1000 iterations)| -|rtoml|0.16s (1000 iterations)|0.11s (1000 iterations)| -|qtoml|3.47s (1000 iterations)|0.96s (1000 iterations)| +|tomli/tomli_w|1.06s (1000 iterations)|0.37s (1000 iterations)| +|tomlkit|20.23s (1000 iterations)|0.42s (1000 iterations)| +|pytomlpp|0.27s (1000 iterations)|0.17s (1000 iterations)| +|rtoml|0.18s (1000 iterations)|0.11s (1000 iterations)| +|qtoml|3.29s (1000 iterations)|0.84s (1000 iterations)| diff --git a/reports/with_toml-test_v1.1.0.md b/reports/with_toml-test_v1.1.0.md index 36db276..801630d 100644 --- a/reports/with_toml-test_v1.1.0.md +++ b/reports/with_toml-test_v1.1.0.md @@ -86,12 +86,12 @@ Literally `.dumps({"v": [1, 1.2, True, "string"]})` | |Dumped value or error| |-|-----------------------| -|toml|v = [ 1, 1.2, true, "string",]
| -|tomli/tomli_w|v = [
1,
1.2,
true,
"string",
]
| -|tomlkit|v = [1, 1.2, true, "string"]
| -|pytomlpp|v = [ 1, 1.2, 1, 'string' ]| -|rtoml|v = [1, 1.2, true, "string"]
| -|qtoml|v = [1, 1.2, true, 'string']
| +|toml|v = \[ 1, 1.2, true, "string",\]
| +|tomli/tomli_w|v = \[
    1,
    1.2,
    true,
    "string",
\]
| +|tomlkit|v = \[1, 1.2, true, "string"\]
| +|pytomlpp|v = \[ 1, 1.2, 1, 'string' \]| +|rtoml|v = \[1, 1.2, true, "string"\]
| +|qtoml|v = \[1, 1.2, true, 'string'\]
| ## Loading a heterogenous array @@ -103,11 +103,11 @@ Literally `.loads('v = [1, 1.2, True, "string"]')` | |Loaded as| |-|-----------------------| |toml|Not a homogeneous array (line 2 column 1 char 1)| -|tomli/tomli_w|{'v': [1, 1.2, True, 'string']}| -|tomlkit|{'v': [1, 1.2, True, 'string']}| -|pytomlpp|{'v': [1, 1.2, True, 'string']}| -|rtoml|{'v': [1, 1.2, True, 'string']}| -|qtoml|{'v': [1, 1.2, True, 'string']}| +|tomli/tomli_w|`{'v': [1, 1.2, True, 'string']}`| +|tomlkit|`{'v': [1, 1.2, True, 'string']}`| +|pytomlpp|`{'v': [1, 1.2, True, 'string']}`| +|rtoml|`{'v': [1, 1.2, True, 'string']}`| +|qtoml|`{'v': [1, 1.2, True, 'string']}`| ## Dumping a nested array @@ -118,12 +118,12 @@ Literally `.dumps({"v": [[1], [1, 2]]})` | |Dumped value or error| |-|-----------------------| -|toml|
v = [ [ 1,], [ 1, 2,],]
| -|tomli/tomli_w|
v = [
[
1,
],
[
1,
2,
],
]
| -|tomlkit|
v = [[1], [1, 2]]
| -|pytomlpp|
v = [ [ 1 ], [ 1, 2 ] ]
| -|rtoml|
v = [[1], [1, 2]]
| -|qtoml|
v = [[1], [1, 2]]
| +|toml|v = \[ \[ 1,\], \[ 1, 2,\],\]
| +|tomli/tomli_w|v = \[
    \[
        1,
    \],
    \[
        1,
        2,
    \],
\]
| +|tomlkit|v = \[\[1\], \[1, 2\]\]
| +|pytomlpp|v = \[ \[ 1 \], \[ 1, 2 \] \]| +|rtoml|v = \[\[1\], \[1, 2\]\]
| +|qtoml|v = \[\[1\], \[1, 2\]\]
| ## Loading a nested array @@ -134,12 +134,12 @@ Literally `.loads('v = [[1], [1, 2]]')` | |Loaded as| |-|-----------------------| -|toml|{'v': [[1], [1, 2]]}| -|tomli/tomli_w|{'v': [[1], [1, 2]]}| -|tomlkit|{'v': [[1], [1, 2]]}| -|pytomlpp|{'v': [[1], [1, 2]]}| -|rtoml|{'v': [[1], [1, 2]]}| -|qtoml|{'v': [[1], [1, 2]]}| +|toml|`{'v': [[1], [1, 2]]}`| +|tomli/tomli_w|`{'v': [[1], [1, 2]]}`| +|tomlkit|`{'v': [[1], [1, 2]]}`| +|pytomlpp|`{'v': [[1], [1, 2]]}`| +|rtoml|`{'v': [[1], [1, 2]]}`| +|qtoml|`{'v': [[1], [1, 2]]}`| ## Dumping keeps order of keys? @@ -312,11 +312,11 @@ using data provided by `pytomlpp` | |Loading speed|Dumping speed| |-|-|-| |toml|Excluded (heterogeneous arrays not supported)|Excluded (heterogeneous arrays not supported)| -|tomli/tomli_w|7.50s (1000 iterations)|3.23s (1000 iterations)| -|tomlkit|139.95s (1000 iterations)|2.37s (1000 iterations)| -|pytomlpp|1.37s (1000 iterations)|0.97s (1000 iterations)| -|rtoml|0.96s (1000 iterations)|values must be emitted before tables| -|qtoml|20.08s (1000 iterations)|4.86s (1000 iterations)| +|tomli/tomli_w|7.28s (1000 iterations)|3.27s (1000 iterations)| +|tomlkit|144.16s (1000 iterations)|2.23s (1000 iterations)| +|pytomlpp|1.41s (1000 iterations)|0.95s (1000 iterations)| +|rtoml|0.98s (1000 iterations)|values must be emitted before tables| +|qtoml|18.94s (1000 iterations)|4.87s (1000 iterations)| ## Running speed with data provided by `rtoml` @@ -329,11 +329,11 @@ provided by `rtoml` | |Loading speed|Dumping speed| |-|-|-| |toml|Excluded (heterogeneous arrays not supported)|Excluded (heterogeneous arrays not supported)| -|tomli/tomli_w|1.65s (1000 iterations)|0.56s (1000 iterations)| -|tomlkit|30.99s (1000 iterations)|0.91s (1000 iterations)| -|pytomlpp|0.28s (1000 iterations)|0.20s (1000 iterations)| -|rtoml|0.20s (1000 iterations)|0.05s (1000 iterations)| -|qtoml|5.13s (1000 iterations)|1.43s (1000 iterations)| +|tomli/tomli_w|1.79s (1000 iterations)|0.62s (1000 iterations)| +|tomlkit|31.72s (1000 iterations)|0.74s (1000 iterations)| +|pytomlpp|0.26s (1000 iterations)|0.22s (1000 iterations)| +|rtoml|0.20s (1000 iterations)|0.06s (1000 iterations)| +|qtoml|4.90s (1000 iterations)|1.24s (1000 iterations)| ## Running speed with data provided by `tomli` @@ -346,9 +346,9 @@ provided by `tomli` | |Loading speed|Dumping speed| |-|-|-| |toml|Excluded (heterogeneous arrays not supported)|Excluded (heterogeneous arrays not supported)| -|tomli/tomli_w|1.16s (1000 iterations)|0.40s (1000 iterations)| -|tomlkit|19.50s (1000 iterations)|0.40s (1000 iterations)| -|pytomlpp|0.23s (1000 iterations)|0.15s (1000 iterations)| -|rtoml|0.16s (1000 iterations)|0.10s (1000 iterations)| -|qtoml|3.35s (1000 iterations)|0.84s (1000 iterations)| +|tomli/tomli_w|1.12s (1000 iterations)|0.38s (1000 iterations)| +|tomlkit|20.12s (1000 iterations)|0.37s (1000 iterations)| +|pytomlpp|0.25s (1000 iterations)|0.16s (1000 iterations)| +|rtoml|0.17s (1000 iterations)|0.10s (1000 iterations)| +|qtoml|3.34s (1000 iterations)|0.93s (1000 iterations)| diff --git a/reports/with_toml-test_v1.2.0.md b/reports/with_toml-test_v1.2.0.md index 1303c21..274b7ed 100644 --- a/reports/with_toml-test_v1.2.0.md +++ b/reports/with_toml-test_v1.2.0.md @@ -86,12 +86,12 @@ Literally `.dumps({"v": [1, 1.2, True, "string"]})` | |Dumped value or error| |-|-----------------------| -|toml|v = [ 1, 1.2, true, "string",]
| -|tomli/tomli_w|v = [
1,
1.2,
true,
"string",
]
| -|tomlkit|v = [1, 1.2, true, "string"]
| -|pytomlpp|v = [ 1, 1.2, 1, 'string' ]| -|rtoml|v = [1, 1.2, true, "string"]
| -|qtoml|v = [1, 1.2, true, 'string']
| +|toml|v = \[ 1, 1.2, true, "string",\]
| +|tomli/tomli_w|v = \[
    1,
    1.2,
    true,
    "string",
\]
| +|tomlkit|v = \[1, 1.2, true, "string"\]
| +|pytomlpp|v = \[ 1, 1.2, 1, 'string' \]| +|rtoml|v = \[1, 1.2, true, "string"\]
| +|qtoml|v = \[1, 1.2, true, 'string'\]
| ## Loading a heterogenous array @@ -103,11 +103,11 @@ Literally `.loads('v = [1, 1.2, True, "string"]')` | |Loaded as| |-|-----------------------| |toml|Not a homogeneous array (line 2 column 1 char 1)| -|tomli/tomli_w|{'v': [1, 1.2, True, 'string']}| -|tomlkit|{'v': [1, 1.2, True, 'string']}| -|pytomlpp|{'v': [1, 1.2, True, 'string']}| -|rtoml|{'v': [1, 1.2, True, 'string']}| -|qtoml|{'v': [1, 1.2, True, 'string']}| +|tomli/tomli_w|`{'v': [1, 1.2, True, 'string']}`| +|tomlkit|`{'v': [1, 1.2, True, 'string']}`| +|pytomlpp|`{'v': [1, 1.2, True, 'string']}`| +|rtoml|`{'v': [1, 1.2, True, 'string']}`| +|qtoml|`{'v': [1, 1.2, True, 'string']}`| ## Dumping a nested array @@ -118,12 +118,12 @@ Literally `.dumps({"v": [[1], [1, 2]]})` | |Dumped value or error| |-|-----------------------| -|toml|
v = [ [ 1,], [ 1, 2,],]
| -|tomli/tomli_w|
v = [
[
1,
],
[
1,
2,
],
]
| -|tomlkit|
v = [[1], [1, 2]]
| -|pytomlpp|
v = [ [ 1 ], [ 1, 2 ] ]
| -|rtoml|
v = [[1], [1, 2]]
| -|qtoml|
v = [[1], [1, 2]]
| +|toml|v = \[ \[ 1,\], \[ 1, 2,\],\]
| +|tomli/tomli_w|v = \[
    \[
        1,
    \],
    \[
        1,
        2,
    \],
\]
| +|tomlkit|v = \[\[1\], \[1, 2\]\]
| +|pytomlpp|v = \[ \[ 1 \], \[ 1, 2 \] \]| +|rtoml|v = \[\[1\], \[1, 2\]\]
| +|qtoml|v = \[\[1\], \[1, 2\]\]
| ## Loading a nested array @@ -134,12 +134,12 @@ Literally `.loads('v = [[1], [1, 2]]')` | |Loaded as| |-|-----------------------| -|toml|{'v': [[1], [1, 2]]}| -|tomli/tomli_w|{'v': [[1], [1, 2]]}| -|tomlkit|{'v': [[1], [1, 2]]}| -|pytomlpp|{'v': [[1], [1, 2]]}| -|rtoml|{'v': [[1], [1, 2]]}| -|qtoml|{'v': [[1], [1, 2]]}| +|toml|`{'v': [[1], [1, 2]]}`| +|tomli/tomli_w|`{'v': [[1], [1, 2]]}`| +|tomlkit|`{'v': [[1], [1, 2]]}`| +|pytomlpp|`{'v': [[1], [1, 2]]}`| +|rtoml|`{'v': [[1], [1, 2]]}`| +|qtoml|`{'v': [[1], [1, 2]]}`| ## Dumping keeps order of keys? @@ -312,11 +312,11 @@ using data provided by `pytomlpp` | |Loading speed|Dumping speed| |-|-|-| |toml|Excluded (heterogeneous arrays not supported)|Excluded (heterogeneous arrays not supported)| -|tomli/tomli_w|8.17s (1000 iterations)|4.00s (1000 iterations)| -|tomlkit|144.28s (1000 iterations)|2.39s (1000 iterations)| -|pytomlpp|1.53s (1000 iterations)|1.11s (1000 iterations)| -|rtoml|1.14s (1000 iterations)|values must be emitted before tables| -|qtoml|19.34s (1000 iterations)|4.92s (1000 iterations)| +|tomli/tomli_w|7.34s (1000 iterations)|3.21s (1000 iterations)| +|tomlkit|146.22s (1000 iterations)|2.32s (1000 iterations)| +|pytomlpp|1.61s (1000 iterations)|1.08s (1000 iterations)| +|rtoml|1.00s (1000 iterations)|values must be emitted before tables| +|qtoml|18.91s (1000 iterations)|5.37s (1000 iterations)| ## Running speed with data provided by `rtoml` @@ -329,11 +329,11 @@ provided by `rtoml` | |Loading speed|Dumping speed| |-|-|-| |toml|Excluded (heterogeneous arrays not supported)|Excluded (heterogeneous arrays not supported)| -|tomli/tomli_w|1.63s (1000 iterations)|0.57s (1000 iterations)| -|tomlkit|31.80s (1000 iterations)|0.82s (1000 iterations)| -|pytomlpp|0.24s (1000 iterations)|0.20s (1000 iterations)| -|rtoml|0.20s (1000 iterations)|0.05s (1000 iterations)| -|qtoml|4.59s (1000 iterations)|1.33s (1000 iterations)| +|tomli/tomli_w|1.71s (1000 iterations)|0.56s (1000 iterations)| +|tomlkit|30.65s (1000 iterations)|0.90s (1000 iterations)| +|pytomlpp|0.30s (1000 iterations)|0.24s (1000 iterations)| +|rtoml|0.23s (1000 iterations)|0.06s (1000 iterations)| +|qtoml|5.47s (1000 iterations)|1.47s (1000 iterations)| ## Running speed with data provided by `tomli` @@ -346,9 +346,9 @@ provided by `tomli` | |Loading speed|Dumping speed| |-|-|-| |toml|Excluded (heterogeneous arrays not supported)|Excluded (heterogeneous arrays not supported)| -|tomli/tomli_w|1.20s (1000 iterations)|0.39s (1000 iterations)| -|tomlkit|20.44s (1000 iterations)|0.41s (1000 iterations)| -|pytomlpp|0.24s (1000 iterations)|0.16s (1000 iterations)| +|tomli/tomli_w|1.25s (1000 iterations)|0.42s (1000 iterations)| +|tomlkit|19.34s (1000 iterations)|0.39s (1000 iterations)| +|pytomlpp|0.25s (1000 iterations)|0.16s (1000 iterations)| |rtoml|0.16s (1000 iterations)|0.10s (1000 iterations)| -|qtoml|3.38s (1000 iterations)|0.86s (1000 iterations)| +|qtoml|3.19s (1000 iterations)|0.87s (1000 iterations)| diff --git a/toml_bench/cases/hetero_array.py b/toml_bench/cases/hetero_array.py index 7620bf9..a338c98 100644 --- a/toml_bench/cases/hetero_array.py +++ b/toml_bench/cases/hetero_array.py @@ -8,7 +8,12 @@ def run(self) -> Any: "v": [1, 1.2, True, "string"] } try: - return self.api.dumps(v1) + return ( + self.api.dumps(v1) + .replace('[', r'\[') + .replace(']', r'\]') + .replace(' ', ' ') + ) except Exception as e: return e @@ -20,7 +25,7 @@ def run(self) -> Any: v = [1, 1.2, true, "string"] """ try: - return self.api.loads(v1) + return f"`{self.api.loads(v1)}`" except Exception as e1: return e1 @@ -31,7 +36,12 @@ def run(self) -> Any: "v": [[1], [1, 2]] } try: - return '
' + self.api.dumps(v1) + '
' + return ( + self.api.dumps(v1) + .replace('[', r'\[') + .replace(']', r'\]') + .replace(' ', ' ') + ) except Exception as e: return e @@ -43,6 +53,6 @@ def run(self) -> Any: v = [[1], [1, 2]] """ try: - return self.api.loads(v1) + return f"`{self.api.loads(v1)}`" except Exception as e1: return e1