# Responsive input sliders - is there a better way?

I am building an app where a user controls inputs via multiple sliders each with discrete steps. The app then uses the combination of slider values to run some calculations and returns back an output value.

The sliders are meant to be highly responsive, so the user can immediately see the impact of their input combination on the output value -so I have resorted to eagerly calculating ALL possible combinations of sliders and letting the client query the results in the browser itself for faster response times.

The problem is that the number of possible combinations can seriously explode. If I have 6 inputs each with 10 steps, that is 10^6 = a million possible combinations! That's way too expensive to calculate eagerly.

Is there a better way to do this? I could try to restrict the number of sliders that can be moved at any point, to lower the solution space...but wondering if there's a better solution out there.

• $5$ inputs with $10$ steps is $10^5$ combinations. – Steven May 29 '20 at 17:04
• You're right! Its 100,000 combinations and not 9.8 million. Unfortunately that's still too expensive to eagerly calculate for me so the intent of the question still stands. – Anubhav May 29 '20 at 17:17
• It's a bit hard to answer this question without knowing more details about the specific problem. Also this problem is really in topic here if there is some theoretical issue behind it (i.e., it doesn't just boil down to implementation technique/engineering trick to speed things up). Are you sure the result can't be computed on the client when it is needed? If it is too slow, can you come up with a data structure that possibly takes a long time to compute but it is compact an then can quickly report a solution to your problem given the sliders? – Steven May 29 '20 at 17:46
• @Anubhav All you need to do is to compute about 10 combinations. A user can only drag one slider at a time. When the user switches to another slider, try responding within a fraction of a second. – John L. May 29 '20 at 18:17
• @JohnL. Not sure if I follow you. While a user can move only one slider at a time, they can set multiple sliders to non-default values? So for e.g. we start with all sliders at position. Then the user moves slider A to position 2 and slider B to position 3. Are you suggesting calculating a "smaller subset" of possible solutions each time the user moves only one slider? – Anubhav May 29 '20 at 18:22