Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run benchmarks with rtoml v0.11? #7

Open
samuelcolvin opened this issue Jun 24, 2024 · 7 comments
Open

Run benchmarks with rtoml v0.11? #7

samuelcolvin opened this issue Jun 24, 2024 · 7 comments

Comments

@samuelcolvin
Copy link

I'd love to see how rtoml v0.11 (specifically samuelcolvin/rtoml#78 where the GIL pool was removed from pyo3) effects performance.

@samuelcolvin samuelcolvin changed the title Run benchmarks with rtoml v0.11 Run benchmarks with rtoml v0.11? Jun 24, 2024
@pwwang
Copy link
Owner

pwwang commented Jun 25, 2024

It's incredibly fast! See updated README.md

@pwwang pwwang closed this as completed Jun 25, 2024
@samuelcolvin
Copy link
Author

Nice! Any chance you could include the benchmark example from cpptoml like you used to, even if that package has been removed?

Multiple benchmark cases are useful.

@pwwang
Copy link
Owner

pwwang commented Jun 25, 2024

It's removed because there's a case that cannot be loaded by rtoml. I will give more details later.

@pwwang
Copy link
Owner

pwwang commented Jun 25, 2024

I found the culprit. It's the item here that when loaded, can't be dumped again with rtoml:

https://github.com/bobfang1992/pytomlpp/blob/47d705b909deee0fa7a3c65624bfa83ea87f578d/benchmark/data.toml#L431-L437

[terrible.capable-tent.wilderness-aromatic.birds.naughty-blind]
bake-scatter-cross = [
    234,
    { attempt-selfish-ghost = 08:43:45, draconian-ski-scintillating = 1911-03-24T12:01:06-01:20, dreary = 266 },
    'innocent broken equable adhesive spiritual title respect'
] # hard-to-find protective
ticket-enthusiastic-delightful = [ 428, 12:49:26, [ 07:10:40, 'neck unadvised finicky stale rest', true ] ]

This is the error:

[TomlSerializationError] values must be emitted before tables

A simple way to reproduce:

import rtoml

toml = """
[a]
b = [234, { c = 1, d = 2, e = 3}, 'abc']
f = [345, "def", [4, "ghi", 456]
"""

loaded = rtoml.loads(toml)
rtoml.dumps(loaded)

Error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/~/.cache/pypoetry/virtualenvs/toml-bench-TNBybMrA-py3.12/lib/python3.12/site-packages/rtoml/__init__.py", line 62, in dumps
    return serialize(obj, none_value=none_value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_rtoml.TomlSerializationError: values must be emitted before tables

@pwwang pwwang reopened this Jun 25, 2024
@samuelcolvin
Copy link
Author

thanks, I'll look into it.

But that's not new, does that mean they've changed their examples?

@pwwang
Copy link
Owner

pwwang commented Jun 25, 2024

That's wired. The file was created 2 years ago.

Should I refer this to a new issue in rtoml repo? I think it fits better there.

@samuelcolvin
Copy link
Author

yes please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants