-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
Refactored AssetDB config file search to allow more wildcards #148
Conversation
716251c
to
5258e46
Compare
This is a great optimisation, thank you! I agree the find method seems to be best here, but I think I've found a couple of holes:
|
So basically we would check:
which is around 10ms slower than before.
I was thinking about it but decided to go for the easier and route.
Which leads to the issue that |
Personally, when I see Could we check if it matches the beginning and/or the end depending on where the wildcards are? (in the example I gave, Also, IIRC EDIT: There's a method in |
No the issue was that sometimes default value is a reference:
this can not be compared to with an int (which is the correct return value). Anyhow that's not needed anymore thanks to the section check. So I updated both versions (is pushed). Regex has a global regex cache to avoid compiling the same regex all over again. This is quite the speedup. The regex might be a valid option after all? It would catch all possible wildcards. EDIT: However, regex is also more dangerous. What if the filename is something |
60f082a
to
6a497a5
Compare
Yeah, I think with regex there's going to be so many edge cases we need to worry about that I don't think it's worth implementing (plus, I think having the wildcards anywhere might be a bit overkill, the wildcards at the beginning and end work fine for 99% of use cases). With the find method, we just need to test wildcards at the beginning, at the end, and at both ends. |
6a497a5
to
9a83821
Compare
9a83821
to
d0b087c
Compare
Cleaned up, removed regex and added documentation. |
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.
Looks good!
Fixes/Solves
The AssetDB config search was done via an recursive call. This is usually slow.
I tried to refactor the
_get_file_config_value
function. I tried two methods:Both methods would allow different wildcards for the config file:
I compared the loading times:
Assets used:
While I would like a regex approach I don't think it is worth sacrificing loading times. Especially with loarget packs and more assets, it will take even longer.
Using the find method we are: faster, don't have a recursive call, and would be able to use wildcards at the beginning:
All 3 combinations would work.
The method I used is:
What are your thoughts about this?
Would solve #146