-
Notifications
You must be signed in to change notification settings - Fork 107
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
Performance test against toml-rs
#132
Comments
We take about twice as long, with the base API. with the easy API, we take even longer. Ideas
|
My plan is to write up a bench for cargo to see how it performs in a more real-world use case and work with others on setting an acceptable performance target. I'll then look at holistic performance improvements, like using a String type in cargo and toml_edit with small-string optimization or caching parsed results for immutable Cargo.tomls (ie in the registry) in a more optimizable format, like json or cbor. rust-lang/cargo#9935 is relevant for the benchmark |
I've done small-string optimization for formatting and keys and various other improvements and brought parse time on a medium Potential next steps
I guess I'm stuck with the above plan of moving from micro-benchmark to real-world resolver benchmarks. |
We've now dropped from the original 250us to 180us. Still a good distance to the goal of 120us. combine's |
Current breakdown for running my example, without printing
|
Looks like the only options for dropping the
|
Another option I considered is rewriting parser entirely using a recursive descent as done toml-rs. That's also a decent amount of work, but we'd gain more control this way in both error messages and overhead. |
Yes, its good to call that one out. I had originally dismissed it because I assume it'll be a significant amount of work to rewrite from scratch or even to figure out how to reuse parts of toml-rs with format-preserving. |
Also, one thing I've appreciated about |
Wow, this and your blog post were a fun read, @epage! I'm very happy to see someone as dedicated and talented as you taking on this issue :) One maybe stupid question: Why didn't you benchmark parsing big |
Good question and glad you asked so I can get these things recorded. When talking with Alex on Zulip, their main performance concern is the Resolver and specifically they've seen the parsing of The reason why writing |
On a related note, I've been asked by others on why I don't do small-string optimizations for Values.
A non-reason to use |
Here is the start of Cargo's resolver benchmark: rust-lang/cargo#9955 I've not dug into it yet but I've been told its not expected to help in our case. As it gets merged, we'll need to profile it to see if it looks like a relevant case and possibly add new cases to help. |
Benchmarks came in around 5% slower. Still acceptable for cargo |
The cargo team is concerned about negatively impacting
cargo
s performance in switching totoml_edit
. Specifically, they are concerned about parsing large dependency trees.It is unclear how much impact
toml-rs
has on the whole operation and how much would be solved byCargo.toml
files in binarycargo
tosmol_str
orkstring
But we should at least be able to say how we compare with the same API (#129)
toml-rs
API on top oftoml_edit
#129toml_edit
,toml-rs
API on top oftoml_edit
#129, andtoml-rs
toml-rs
The text was updated successfully, but these errors were encountered: