-
-
Notifications
You must be signed in to change notification settings - Fork 713
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
perf: Reduce the amount of code generated for path! #721
base: master
Are you sure you want to change the base?
Conversation
Any chance of this getting merged? |
Thanks for the PR! I'd prefer to keep the requirement that |
I'd just add a |
78dbb98
to
91db345
Compare
Rebased with the fix to path |
Any further issues with this? The assert is restored and I added a hidden |
3a09a8e
to
fd1470a
Compare
@seanmonstar Fixed and added a test |
I see a new label I don't think this PR is waiting on the Author (@Marwes) but rather it is waiting for the maintainer @seanmonstar to review. |
ah righ sorry, as I saw a question still unresolved I thought it wasn't yet addressed. I will try to review this PR this weekend 👍 |
LGTM, only some minor nit :) |
By join static string literals in path! we instantiate less `path` calls and less `and` calls (since there are less things to join). This changes the behaviour of `path` to accept `/` if this is not wanted this could instead be hidden as an implementation detail.
Only used once and it bloats the LLVM IR
Resurrecting this since I am back on project that uses warp. The PR as is seemed to have been mostly accepted (?) but I rebased it (no conflicts) and added the last commit to make the assertion a bit clearer. Example llvm-lines/(re)compile time for a crate which uses warp::path! quite heavily. Before
After
|
This does two things to reduce the amount of code
path!
generates, first it removeswarp::any()
filter at the start of each path, therefore removing one level ofAnd
as well.Next I modified the macro to accumulate consecutive string literal segments and combining them into one via
concat!
. Since each segment generates its own static type this significantly reduce the amount of code when this applies (path!("abc" / "123" / "456")
). I did have to cahge the behaviour ofpath()
for this to accept/
but I can change this combining to just be an implementation detail instead.