-
-
Notifications
You must be signed in to change notification settings - Fork 917
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
Removes map of class to module #5026
Removes map of class to module #5026
Conversation
Allows users to disconnect from a server, and specify a `reason` message too.
Marked <0.5.6 as breaking, seeing the mixin changes.
Made it always disable in water because it's impossible to avoid taking hunger while moving in water
Co-Authored-By: Damian <[email protected]>
Co-Authored-By: Damian <[email protected]>
Co-Authored-By: Damian <[email protected]>
- fix smart toggle - update only trusted disconnect message - some clarifications for health and smart toggle settings closes MeteorDevelopment#4201
I mean you are still filtering the list based on the class, so it has same effect as a map, no? |
Kind of. For public <T extends Module> T get(Class<T> klass) absolutely, but all of the other .values() calls, it will have the correct behavior. Currently the .values() only gets one instance of the multiple modules I've added |
Ah, well in that case I think it's still good to keep the map purely for the get operation. Searching the list is much slower and retrieving the module is called very frequently. |
On the surface level that's what it would seem, but it's a micro optimization that in all reality probably makes no difference. Take a look at this for example. https://medium.com/@dejangegic100/why-benchmarks-are-lying-to-you-and-hash-maps-are-not-always-faster-than-arrays-ac42cae649a7 |
That being said, I can keep it for the get by class portion if you'd prefer |
your pull request makes the average runtime of now consider that |
i'm fairly curious in seeing what your generic module builder looks like though |
@RacoonDog How did you take those benchmarks? |
I just did some benchmarking and it looks like you're right. It ran a little faster than 73x (I think it was 50 something) but setting up the stream is more resource intensive than I thought. I swapped it out with a plain ol for loop and it was was significantly better but still 5x slower than using the map. I'll update my pr in a bit |
5223b44
to
06d02fe
Compare
Note, I'm closing this branch due to mangled history from trying to fix accidentally leaking private information |
Type of change
Description
Makes it so there's a single source of truth for the modules list. I've been running into an issue creating an addon with multiple modules that have the same class created by a generic module builder.
Related issues
N/A
How Has This Been Tested?
Running Meteor and making sure the modules load correctly.
Checklist: