Bubble Challenge - Reducing Workload Units!

I’m a first time bubbler (woo!) creating an app to store data from inputs arranged in a table interface. When it’s working, the user can enter data and seamlessly have it stored, while retaining the ability to edit as desired.

While my app works smoothly, it is workload intensive and will not function for the amount users I’m expecting.

Context: The table is arranged around date, and when a user “adds a column” it just creates a new date entry.

While the interface looks like it’s one table, it’s actually a repeating group of tables (one for each “data category”).

The Challenge! The current table construction is incredibly inefficient. Each cell is individually looking for it’s own data using “Do a Search” with several filters applied as constraints. That means every cell in this table is doing a search, and killing my workload units.

I arranged it this way, because the user needs to be able to add another Data Category, or Data Stream, when they wish (that’s on a separate page).

Let me know what your thoughts are! Am I missing something here?

Brett

Welcome to Bubble (woo!)

The first thing you can do is lighten the ‘datas’ dataType. Does it have a lot of fields? The more bytes of data you are returning from the database the more WUs you’l consume. If its a heavy dataType you could create a Search DataType linked to ‘datas’ which just contains the data you need for the table.

If the data you have doesn’t change too often you could use Local Storage to store the data instead of the database. This is not a native bubble feature but there are plugins / simple Javascript to do this.
You could also use @gaimed’s WU Reducer

Potentially there are also ways to get the table to populate using a single search instead of running a search per cell.
Sounds crazy, but this can be done either by ‘delegating’ some work to the Client side (You could run a search to fetch all data needed for the whole table. Ideally you would sort in a way which could be mapped onto the table using item#, but if not you can use client-side filtering).
A more advanced technique would be to actually summarise the entire table content in a single Thing, using a new DataType. This datatype would have a text field that contains all the numbers in the table, as well as another field containing the list of dates, as well as one for the categories. This can have huge WU savings, but it can be hard to handle.

Optimisation has many factors, and optimisation can lead to over-optimisaton. Optimise a feature of your app too much, and another part of your app will become more complex/hard to handle.
Is this table the only place in your app where you are fetching this data? Are you just displaying the data? Do you want to allow for filtering/sorting?
So, before you go and optimise this table so that it only takes one search, what exactly is this table showing? Can you give a high level description of what the table + your app is actually doing?

5 Likes

Everything above is correct. I’ll expand it with an arbitrary example of how you might make something more efficient.

Suppose we have a ten row table of Users. On each User row, we want to display the total number of payments the User has made on the platform. The simple route is placing a Do a search for payments for User = Current cell's user : each item's amount:sum. I’d do this most of the time, unless it’s being used really, really frequently.

Instead of this, we can have a hidden repeating group in a popup (though be careful to make sure you’re not loading this data when it’s not needed). This repeating group should show Do a search for Payments:grouped by User with an aggregation for the payment’s amount’s sum. Inside our table, we can reference RepeatingGroup Hidden's List of Groupings:filtered for User = Current cell's user:first item. In theory, that will filter it on the client side which, could save a fair amount of WU. As always with WU stuff, you can only really know after you test it.

From a speed perspective (as opposed to WU), you can check how many searches are done using each method using the network tab and looking for msearch.

4 Likes

Thank you @nico.dicagno and @georgecollier !! Sorry for the late reply - this was super helpful - I’ll let you know how it goes :slight_smile: