Closed zbraniecki closed 5 years ago
Out of curiosity, have you considered the pre-evaluated algorithm we're using in the python resolver now?
The other thing we did in python was to move from dispatch to transformer pattern. That was merely because dispatch was slow. Is that a problem in rust?
Also, can we refer to the js resolver as the js resolver? We don't have a reference resolver yet ;-)
This now passes all tests, retains all functionality, and maintains the performance win of ~60% in resolver tests. I still want to:
but the code matures to a full PR now (so that I start getting CI results and coverage results on this branch) :)
@stasm - I'm still working on porting resolver tests and improving coverage, but I believe this code is ready for preliminary review.
If you prefer me to first document it, I'll postpone the review, but it may be easier for me to know if you approve the general direction before I dive into details.
I think that two interesting concepts that I introduced here, which may be useful to port back to JS are:
tracking
to be more "lazy", instead of eager. That means that when you reference a message, I'll only add this message to the stack if the message goes deeper :) This actually gives a nice perf boost.DisplayableNode
to unify where we turn nodes into displayable pieces and delay doing that until its needed.@manishearth - I'd love to get your feedback on this PR. Majority of the real action is in src/resolve.rs
If you prefer me to first document it, I'll postpone the review, but it may be easier for me to know if you approve the general direction before I dive into details.
Thanks for letting me know. I'll be away next week, so it might best to postpone the review until I'm back.
Okay! I'll work on porting more tests, inline docs and getting review from Manish first then :)
Gonna merge it, and continue working in separate issues.
This is a pretty major refactor of the Resolver, in a pretty POC state of work.
It aims to achieve three main goals:
Cow<str>
to lower the CPU and memory cost of simple resolutionsThe code is far from being completed, but it already renders really promising performance wins:
master:
bundle-tests branch:
All three benchmarks put the branch at 60-70% faster, mostly due to lack of string copying for simple strings.
I'd like to consider this refactor for 0.6.
@stasm - this is likely too early for review, but the POC is complete enough for you to asses the general approach. Lmk!