Skip to content

Share/deduplicate executor for multiple entities #1976

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

Closed
mvorisek opened this issue Jan 23, 2023 · 0 comments · Fixed by #1980
Closed

Share/deduplicate executor for multiple entities #1976

mvorisek opened this issue Jan 23, 2023 · 0 comments · Fixed by #1980

Comments

@mvorisek
Copy link
Member

mvorisek commented Jan 23, 2023

Here is an analysis of CardDeck (related with #1848 as table rows should be rendered via Views and not with cloned template) performance with many Cards:

  • performance of atk4/data is top notch (entity is iterated/loaded much faster then one Card is added/rendered)
  • 1 Card /wo any executor takes ~0.6 ms to add/render
  • there is no single significant bottleneck, but large part of the time is spent in templating, as each Card consists of several Views, each with ~20 template tag tree children
  • adding a Card executor is slow
    • CardDeck::setMdel() calls Card::addClickAction
    • creating/rendering executor trigger button is ok, it takes ~0.1 ms / single (one UA) button
    • which calls Button::on with atk4/data UserAction
    • an executor is created here:

image

there are two problems:

  1. ExecutorFactory::createExecutor() creating executor itself is quite slow (~0.4 ms / single (one UA) executor), it cannot be significantly optimized, the only solution is to create an executor for a model once and share/deduplicate it for all entities (table rows, Cards, ...)

  2. ModalExecutor::executeModelAction() executor should not be initialized/rendered until needed/triggered (Modal executor should (re)load whole modal incl. buttons #1928, ~1.0 ms / single (one UA) executor)

(3. also each executor (currently/with point 1 and 2) takes quite a lot of memory (~50 KB / single (one UA) executor) and significantly increase the total rendered html/js size (~4 KB / single (one UA) executor))

the good new is, at least in Card::addClickAction(), executor is created from model (not entity) atk4/data UA, ID is passed as 1st $default arg - so point 1 should be doable /wo heavy refactoring

given the need to share/deduplicate UA executors in atk4/ui at least, we should aim to support model (not entity) atk4/data UA and maybe even drop entity (not model) atk4/data UA completely in the future

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

Successfully merging a pull request may close this issue.

1 participant