-
Notifications
You must be signed in to change notification settings - Fork 122
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
Speed up filter processing #476
base: master
Are you sure you want to change the base?
Speed up filter processing #476
Conversation
Holy! This has made such an improvement to my dashboard! I was at the point of sacking off all the auto-entities i'd written across mutliple dashboards & replace them with fixed lists again. This has made a massive difference to responsiveness, especially on mobile devices with lower compute. @thomasloven please consider this MR. Until this is rolled in & released, I will be using the forked version. |
FWIW, I eventually went to writing my own dashboard strategy... not because of shortcomings here as much as the pain of trying to shove everything specific I wanted to do into nothing but templates & yaml. (Also because working on this PR taught me enough to make me more confident in writing my own HA-flavored frontend JS.) Anyhow, if you find any issues with my PR please LMK and I'll try to fix them up! |
This looks very interesting. Could you try to clean those out? |
Huh. Not intentional, will try to fix that. |
83ee40c
to
67b79b5
Compare
Whoops! Looks like I accidentally reset my VS Code formatting defaults to Deno a while back. Here's a better breakdown. I've pinned a specific version of prettier (as they recommend) and normalized the formatting to that. It's still a pretty big changeset, but at least it's more readable now. |
babel({ | ||
exclude: "node_modules/**", | ||
babelHelpers: "bundled", |
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.
This was the previous behavior; specifying it explicitly prevents a build-time warning.
@mrnerdhair tested out your branch on HA locally, performance looks a lot better! FWIW -- testing steps -- I had to create a new build of the hass-custom-devcontainer, forked here: https://github.com/bobbravo2/hass-custom-devcontainer That and the |
Fixes #379.
Filtering and sorting didn't scale well; area and device processing in particular was O(n^2). In my environment, with ~3000 entities and ~200 devices, displaying a handful of rooms involved 30-second load times.
I've approached the problem by breaking the filter and sort functions down into sections to allow re-use of various intermediate results. I've also added an improved caching infrastructure to prevent multiple loads of the areas/devices/entities/labels lists being triggered by a flurry of initial cache misses.
These changes bring my ~30sec case down to ~200ms.