marzer/tomlplusplus

benchmark showing rtoml is faster

bobfang1992 opened this issue · 1 comments

Hi,

I recently rerun the benchmark in pytomlpp and here is the result:

Parsing data.toml 1000 times:
     rtoml:   0.540 s
  pytomlpp:   0.542 s ( 1.00x)
     tomli:   2.923 s ( 5.40x)
     qtoml:   8.748 s (16.18x)
   tomlkit:  51.608 s (95.49x)
      toml: Parsing failed. Likely not TOML 1.0.0-compliant.

Understand this is not a competition but just want to raise awareness of this if you care about it.

Plus: do you think there is anything I should support in pytomlpp? I see you added quite some features (e.g. json/yaml formatter etc.). And I'm wondering if you have any preference on supporting them in the python API as well.

Thanks!

marzer commented

pytomlpp is slightly faster than rtoml when I run this same benchmark on my own machine. I suspect things like CPU arch, compiler, compiler version, optimization level etc has a lot to do with it, so there's enough noise in the data that I don't think it's worth losing any sleep over, heh.

Plus: do you think there is anything I should support in pytomlpp?

Nah, I think the minimal dict-based API is fine as-is. I implemented those things because there's no built-in/easy way to do them in C++, but in python you've already got the package ecosystem out-of-the-box so users can trivially do those conversions without needing any support from you :)

It would be different if a user needed to convert TOML to JSON/YAML fast, of course, because then it'd need to be done with native code, but I suspect that's a pretty niche situation that you don't need to worry about.