-
Notifications
You must be signed in to change notification settings - Fork 85
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
Much more efficient memory usage and smarter dynamic dispatch usage,... #210
Conversation
…and a bunch of kinda nit-picky changes to docs (including typo fixes)
oh yeah msvc is probably 1.75 if that matters too much I'm gonna have to fix that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
I'm curious to know why you felt memory usage was an issue, especially for a web browser automation crate. What is your use-case? Neither performance nor memory usage are usually critical for this kind of software. That said, I think the ergonomics from a user perspective is mostly unaffected by the changes and in some cases ergonomics is slightly improved (such as element filtering predicates etc) so I'm happy to go ahead with it.
Since we're nit-picking, I've flagged the cases where you've changed the Australian spelling of certain words to American. I'm assuming it wasn't intentional. Normally I wouldn't care too much about the spelling of new contributions, but changing existing documentation to American spelling is a bit much😛.
thirtyfour/src/session/mod.rs
Outdated
use std::rc::Rc; | ||
use std::sync::Arc; | ||
|
||
pub trait IntoTransfer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why IntoTransfer
? What about IntoArcStr
or something more specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Transfer, because were gonna transfer it to the other management task
IntoArcStr would be confusing because why not use Into<Arc> which I didn't use because many of the types added to the impl don't implement Into<Arc>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you have name suggestions I'm up for it I tried to come up with a good name for a good 10 minutes
Personally I don't mind, but some users might not like it. |
What OS? Wondering if there's any documentation updates we can add to fix this. I am on Windows WSL but I've tried it on Linux previously. On Ubuntu you can just install the firefox snap and then run |
I think we can do that by just adding #[async_trait] to |
running |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files
|
a bit of a dumb reason honestly what sparked my initial snooping in the code was I got mad that I had to wrap everything in Box::new and Box::pin for the resolver, and looked at the code and honestly the thing that ticked me off the most to go read the entire codebase and do these changes was because I saw you storing Arc<ElementQueryFn> but ElementQueryFn was Box<dyn ...>, yes again I realize its a bit of a waste to care too much, I ended up taking it as a challenge for the most part, not that it was that bad for performance |
Yep I like the changes you made in that area. The predicate code feels a bit nicer now. |
That's odd. What OS? What arch? Are you downloading the correct version of geckodriver? |
I think this is worth doing |
Once you're done making changes, please provide a summary of the changes and the reasons for them. I feel that these later changes probably should have been a separate PR. Let's not try to change the entire codebase in one commit 😅 |
impl Display for Escaped<'_> { | ||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { | ||
for (i, substring) in self.0.split('\"').enumerate() { | ||
if i != 0 { | ||
f.write_str(", '\"', ")? | ||
} | ||
write!(f, "\"{}\"", substring)?; | ||
} | ||
if self.0.ends_with('\"') { | ||
f.write_str(", '\"'")?; | ||
} | ||
Ok(()) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could have just been a function 🤔 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, because I put escaped into a call of format!()
and I don't think there is a way to access the formatter directly
I kind of use the same patter as any of the std::str::Escape*
hmm yeah, I should |
windows x86_64, I downloaded geckodriver-v0.33.0-win64.zip |
I appreciate the effort you've put in, but dumping a huge code change like this as a PR makes it really difficult to sift through and understand the intent and the implications. I like the improvements to the predicate functions but a lot of other changes seem to increase the complexity of the codebase without offering a tangible real-world benefit either to the developer or to the runtime outcome. I'd even suggest there's a fair chunk that largely comes down to personal preference. This is the first I've seen anyone recommend I think there's an argument for keeping things familiar and not increasing the complexity unnecessarily. |
hmm yea I see your point, and I think I really should make a list of all the changes and detail what how and why I did them as for |
I understand the reason for the Don't worry about splitting it or anything. Let's just put a freeze on the feature changes and I'll have another look through the code and we can go from there. If you can summarise the changes with a bullet point each that would be helpful too. |
here since I'm done with the first part for the first list of major changes you can read through while I write part 2 List of changes:
lets start with
as for
other changes have either been discussed or are very minor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the writeup and for the awesome work. It's much appreciated!
…and a bunch of kinda nit-picky changes to docs (including typo fixes)
I ran the tests this time, I learned, but this time I only ran chrome, because I just could not get the gekodriver to work properly