-
Notifications
You must be signed in to change notification settings - Fork 19
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 of id_tree #60
Comments
again thank you for sharing your performance analyses.
I even created an issue there for another problem that included a suggestion for a possible solution - and nothing happened. The id type that So using snowflake's Since I can't reference github repositories in crates that are not released on crates.io I actually can't use your fork in I have only two options
I have played a bit with a "SimpleTree" implementation that uses parts from @iwburns' |
Currently I'm evaluating syntree created by @udoprog. Thanks a lot for this create! It really looks promising and seems to be much better suitable for I would like to keep the possibility of creating visualized trees as I did with id_tree_layout intact. This could mean that I have to provide an adequate implementation for Maybe, I'm doing this first to get a better feeling on how to work with |
I don't see an immediate reason why that shouldn't be possible. A major difference I've done in 0.14.* which I just recently released though was the ability to have differently sized span indexes and pointer sizes (default being Instead of this: let id: syntree::Id = tree.first().ok_or("missing")?.id(); You'll have to do this (if you're using use syntree::pointer::Width;
let id: <usize as Width>::Pointer = tree.first().ok_or("missing")?.id(); Of course the intent is that Good luck! |
@udoprog |
@udoprog The API for token insertion ( I think it is not necessary for But if I wanted to use I could imagine that having non-contiguous span information in the tree's leaves is a possible use case for other users. As I said before there is no need from my side here. I just stumbled about that. By the way, |
Hm, yeah. It's intended as a non-destructive representation of a syntax tree, which implies a contiguous set of spans from something being processed. Additional information can be carried in the tree though, as is the case with the synthetic strings example, but you'd have to implement that in your own |
Ok, fine. I can live with that. 😉 |
The first step has been taken: |
@dalance Edit: |
In my scenario I counted 5.695.873 elements in this parse tree |
I tried
|
Great, thanks!! 👍 |
As of version |
Very cool! Also, if you don't want to store spans in the tree (which might save you some memory since you're not using them), consider using |
Ok, good hint. I wasn't sure if I will ever need any span information. But as it turned out I won't. |
I investigated the performance of id_tree.
In the flamegraph, many time is consumed by
PartialEq
ofProcessUniqueId
.The
ProcessUniqueId
which is provided by https://github.com/Stebalien/snowflake is 128bit.So I thought another snowflake implementation which provides 64bit id may get performance gain.
I got about 20% performance gain with the custom id_tree which uses https://github.com/BobAnkh/idgenerator.
https://github.com/dalance/id-tree/tree/use_idgenerator
The text was updated successfully, but these errors were encountered: