-
Notifications
You must be signed in to change notification settings - Fork 56
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
Experiment with tyre #93
base: main
Are you sure you want to change the base?
Conversation
Interesting! Is there a performance difference between the two? |
Also need to add
|
I haven't tried! is there a nice benchmark suite somewhere? We are doing one less call to Re.exec, there is one less string copying and there are quite a few less groups, but the extraction might be a tiny bit less efficient (more intermediate tuples), so I'm not sure how it'll turn out. |
That looks pretty nice! |
Interesting -- we do need a simple test suite at some point; I guess Core_bench is still the best one to use here. Wonder if flambda has any effect on those intermediate return tuples... |
So, I discussed with @chambart about that ... flambda has trouble inlining just the right thing (without inlining far too many things unconditionally). So, for now, flambda doesn't really help. However, he also said: "it would be cool, but it doesn't matter in practice". |
(Side note: I could totally create the perfect optimal extraction code with metaocaml/macros ;) |
By the way I came up with some pattern to control how to inline this kind of code correctly with the current flambda. But you probably don't want to use that. It's seriously unreadable and horribly inefficient without flambda. |
So, I started going benchmark experiments. benchmarks are in the bench branch, They are very primitive, but should cover most kind of practical uris. You can run them with tyre in the bench+tyre branch. I was quite unsatisfied with the numbers, so I started doing some optimization work. I finally got the right idea this morning in the shower. :D Modified tyre is Drup/tyre#12. Those are only internal changes, the API doesn't change.
|
Those benchmarks are on 4.03 without flambda, I haven't tried with flambda just yet. |
4.04.0+flambda without any annotation, Not great:
|
This was just an amusing experiment. All the test passes.
I'm pretty sure we could make to_string works too, but I didn't tried (~scheme would be tricky).
If you are interested, I could clean it up and remove the dead code.