Forum Academy Marketplace Showcase Pricing Features

Is ":count = 0" faster, or ":first item is empty"?

When searching to make sure if an item already exists, is it faster to do the search and check to see if the count is 0, or is it faster to get the “first item” and see if that item is empty?

My guess is they’re the same but I would just create two text elements on the screen, one has count = 0 and one has first item and see which one appears first

1 Like

Check this topic, first item seems to be the way to go.

This is the Keith’s motivation:

My experience is that such conditions ARE faster than :count. I believe that, the way Bubble works, if you have a condition that is testing for that state, that state will evaluate to true as soon as the list being tested reaches the non-empty state. (That is, if you are evaluating :count, bubble must wait until the entire search or filter or whatever is done to establish the count. But if you’re just checking for non-zero list length it does not have to do that – as non-zero list length is established as soon as any item populates to the list.).

JohnMark actually tested it (see one of the last post in the topic mentioned above) and came to the same conclusion.

The topic is old and a lot has changed so the best thing to do might be to just test it yourself. Creating 10000 records should not be hard. Create a couple of records yourself, use a button with copy list and it will go pretty fast, otherwise use a backend workflow.

2 Likes