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

Investigate debounce time #4377

Open
louispt1 opened this issue Dec 11, 2024 · 4 comments
Open

Investigate debounce time #4377

louispt1 opened this issue Dec 11, 2024 · 4 comments
Assignees
Labels
Pinned Will never be marked as stale or auto-closed.

Comments

@louispt1
Copy link
Contributor

We should investigate the debounce time for sending requests to the API. A longer debounce time could improve efficiency by batching multiple changes into a single request, reducing the number of calls made to the Engine. However, this comes at the cost of increased delay for processing single-input updates.

The goal is to find the optimal debounce time that:
1. Reduces excessive API calls when users make multiple updates in quick succession.
2. Minimizes delay to ensure a responsive experience for users who are updating a single input at a time.

Key Questions:
• How frequently are users likely to make quick successive updates, and how quick will they be?
• What is the perceived acceptable delay for users between input and response?

@louispt1 louispt1 self-assigned this Dec 11, 2024
@mabijkerk
Copy link
Member

In addition to debounce, we could investigate other options to smoothen the interaction of the user with the interface. Suggestions:

  • Adding a "calculate" button, disabling it will allow the user to set sliders with the model running the calculations
  • Re-calculations seems to be triggered by new charts (and slider changes of course), though sometimes users only want to set a new slider, without having to see the new slide. Perhaps something smart can be done here

Copy link

This issue has had no activity for 60 days and will be closed in 7 days. Removing the "Stale" label or posting a comment will prevent it from being closed automatically. You can also add the "Pinned" label to ensure it isn't marked as stale in the future.

@github-actions github-actions bot added the Stale Issue had no activity for 60 days and will be, or has been, closed. label Feb 11, 2025
@mabijkerk mabijkerk added Pinned Will never be marked as stale or auto-closed. and removed Stale Issue had no activity for 60 days and will be, or has been, closed. labels Feb 11, 2025
@louispt1
Copy link
Contributor Author

Note: this is where the updates are debounced in app.coffee

# Set the update in a cancelable action. When you
  # pull a slider A this method is called. It will call doUpdateRequest
  # after 500ms. When a slider is pulled again, that call will be canceled
  # (so that we don't flood the server). doUpdateRequest will get the dirty
  # sliders, reset all dirtyiness and make an API call.
  handleInputElementsUpdate: =>
    func = $.proxy(@doUpdateRequest, this)
    lockable_fn = -> LockableFunction.deferExecutionIfLocked('update', func)
    Util.cancelableAction('update',  lockable_fn, {'sleepTime': 100})

@mabijkerk
Copy link
Member

Some ideas I can come up with:

  • Switching slides now causes the entire model to reload, including dashboard items. This seems counter-intuitive: the dashboard items should only change when an input is changed. Can we make sure only the chart is actually updated?
  • Switching slides seems to causes consecutive requests to load a chart. This seems inefficient: now you first have to wait for chart 1 to load, then the model will reload again to get chart 2. Can we prevent chart 1 from loading and always switch to the latest chart?
  • Slider changes should always take precedence over chart loading. If you switch to a slide, change and input, you now first have to wait for the chart to load, only then is the new input request sent it seems. Can we prevent the chart from loading when an input is requested?
  • Might be controversial, but the number of charts that we have is not that extensive. Should we fetch charts in the background when the model is otherwise idling? Or would this require to much caching?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pinned Will never be marked as stale or auto-closed.
Projects
None yet
Development

No branches or pull requests

2 participants