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

Add notes for refactoring ResourceItem #7161

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

manup
Copy link
Member

@manup manup commented Aug 9, 2023

The goal is to make ResourceItems as small as possible aka cache friendly, and also very fast. Currently each item results in many heap allocations and is internally not very type safe. We can do a lot better here.

The QString has the biggest impact especially for legacy code which may do hundrets of string comparisons foe each incoming APS Indication, and timestamp to string conversions during WebSocket event generation.

This PR has no code changes only comments to figure out where to go.

BufStringCacheHandle m_strHandle; // for strings which don't fit into \c m_istr
ItemString m_istr; // internal embedded small string
deCONZ::TimeSeconds m_refreshInterval;
QString *m_str = nullptr;
const ResourceItemDescriptor *m_rid = &rInvalidItemDescriptor;
QDateTime m_lastSet;
/*
* TODO(mpi): This is included in the new struct but ultimately I think we should get rid of lastChanged
* and only mark if a change occured as flag. Most uses are lastChanged() == lastSet()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about ddx rules and durationDue?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, indeed for these we might need to keep the exact change timestamp.

@manup manup force-pushed the refactor_resourceitem branch 2 times, most recently from 6a31114 to b050adf Compare September 4, 2023 09:27
The goal is to make ResourceItems as small as possible aka cache friendly and also very fast. Currently each item results in many heap allocations and is internally not very type safe. We can do a lot better here.
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.

None yet

2 participants