Skip to content
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

Allow getting a Version with a file hash #1

Merged
merged 1 commit into from
Jan 27, 2022

Conversation

4JX
Copy link
Contributor

@4JX 4JX commented Jan 27, 2022

Small addition of an undocumented API, makes trying to get the corresponding Modrinth mod a whole lot easier.

Could also consider adding the /download part of it

@theRookieCoder theRookieCoder requested review from theRookieCoder and removed request for theRookieCoder January 27, 2022 17:03
@theRookieCoder
Copy link
Collaborator

Great! I made some changes and I'll upload after merging yours and my changes

@theRookieCoder theRookieCoder merged commit 8ca9a9d into gorilla-devs:master Jan 27, 2022
@4JX
Copy link
Contributor Author

4JX commented Jan 28, 2022

Forgot to mention, but perhaps adding a lazy_static for those regex creations can be considered, every millisecond counts 😛

@theRookieCoder
Copy link
Collaborator

Seems that lazy_regex builds regexes at compile time, so that would be even better right?

@4JX
Copy link
Contributor Author

4JX commented Jan 28, 2022

Seems that lazy_regex builds regexes at compile time, so that would be even better right?

Seems like it has the same speed, for a very unscientific test:
https://gist.github.com/4JX/f9ed141f337b5a8127eb416077d04b35

Manual regex: 3.909945928s
Lazy static: 6.758928ms
Lazy regex: 6.845949ms
Lazy is match: 6.706686ms

@theRookieCoder
Copy link
Collaborator

Looks like regex_is_match!() is the fastest and it has the most readable code imo so I'll use that then

@4JX
Copy link
Contributor Author

4JX commented Jan 28, 2022

Looks like regex_is_match!() is the fastest and it has the most readable code imo so I'll use that then

I'd attribute that win to noise, it depends on the run. Do have to agree on the readability aspect. 👀

@theRookieCoder
Copy link
Collaborator

I'd attribute that win to noise

True true, 0.15ms is negligible

@theRookieCoder
Copy link
Collaborator

Implemented in c16116b crate version v1.4.1!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants