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

Better performance by adding layers and caching #30

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pskowronek
Copy link

Better performance by adding layers and caching. One layer for whole clock and hour hand, the second layer for minute and second hand. All that as virtual canvas then painted to dom canvas.

Also added:

  • periodical config reload every 60s instead of re-reading config every time clock is repainted (+ added TODO comment if it can be known if config changed).
  • nice console.log that Analog Config has been loaded akin to other HACS, however I haven't added version (would be nice to add it)
  • print any caught exception to console.error (as an addition to just displaying that on canvas)

This change improves performance of HA dashboards displayed on older tablets/smartphones (on the wave of 'don't throw away old electronics, re-use them for something useful' :) ).

Disclaimer - checked, it improves performance, probably it could be done better, like even more layers etc.

Better performance by adding layers and caching. One layer for whole clock and hour hand, the second layer for minute and second hand. All that as virtual canvas then painted to dom canvas.

Also added:
- periodical config reload every 60s  instead of re-reading config every time clock is repainted (+ added TODO comment if it can be known if config changed).
- nice console.log that Analog Config has been loaded akin to other HACS, however I haven't added version (would be nice to add it)
- print any caught exception to console.error (as an addition to just displaying that on canvas)

This change improves performance of HA dashboards displayed on older tablets/smartphones (on the wave of 'don't throw away old electronics, re-use them for something useful' :) ).

Disclaimer - checked, it improves performance, probably it could be done better, like even more layers etc.
@tomasrudh
Copy link
Owner

Nice one, I will take a look eventually. 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.

None yet

2 participants