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

Use Map for runtime Device/Group lookups. #1176

Merged
merged 3 commits into from
Sep 6, 2024

Conversation

Nerivec
Copy link
Collaborator

@Nerivec Nerivec commented Sep 6, 2024

Improved test to cover all cases where lookups should be synced.
Fixed group getter return type.

Also marked functions changed for iterator versions in previous PR as deprecated. Pretty sure they can just be removed, but need to double-check and update tests (used in expect in a few places). Also might want to instead rename xyzIterator to xyz for cleaner names. Can be dealt with in another PR.

@Nerivec
Copy link
Collaborator Author

Nerivec commented Sep 6, 2024

We could also optimize Device lookup by nwk addr with a Map<number, string>:

    public static byNetworkAddress(networkAddress: number, includeDeleted: boolean = false): Device | undefined {
        Device.loadFromDatabaseIfNecessary();

        const ieeeAddr = Device.nwkToIeeeCache.get(networkAddress);

        return ieeeAddr ? Device.byIeeeAddr(ieeeAddr, includeDeleted) : undefined;
    }

With cache updated in create, loadFromDatabaseIfNecessary and changeIeeeAddress functions.

@Koenkk
Copy link
Owner

Koenkk commented Sep 6, 2024

We could also optimize Device lookup by nwk addr with a Map<number, string>:

Sounds good!

@Koenkk Koenkk merged commit eb96b55 into Koenkk:master Sep 6, 2024
1 check passed
@Koenkk
Copy link
Owner

Koenkk commented Sep 6, 2024

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants