Level of Complexity List Actions
Question

Hello, I want know the complexity of actions list indexof, list filter, list any.

List IndexOf = O(N) ?

What I know of actions C#, IndexOf = O(N), in Outsystems too ?


What are you trying to accomplish? 

Stacey Levine wrote:

What are you trying to accompany? 

I want know what's the complexity of actions... 

Is a linear search to find the index based on the conditions?


Complexity algorithm in data structure


mvp_badge
MVP

Hi Rodrigo,

I don't have any documentation to support what I'm saying but I would say that all those actions are O(N) because the performance is really bad and that should mean they cycle over all the records. If you want a better performance you would need to built it yourself.

Regards,

Marcelo

mvp_badge
MVP

Hi Marcello, why do you say the performance is "really bad"? For all sane use cases, I've found them to be pretty performant.

That said, since the input list can be anything, I wouldn't know how to improve the speed for such generic actions, so O(N) seems legit.

Kilian Hekhuis wrote:

Hi Marcello, why do you say the performance is "really bad"? For all sane use cases, I've found them to be pretty performant.

That said, since the input list can be anything, I wouldn't know how to improve the speed for such generic actions, so O(N) seems legit.

O(N) this can be bad in same cases... in a cycle for example.
It may be bad to create a structure before using, therefore O(N) in Outsystems. (way easier)
But thinking of performance and complexity, can you do better.
Thanks for helping.

mvp_badge
MVP

Hi Kilian,

Because when you have lists with hundred of thousand of records those actions aren't enough to solve your problems. You can't even use it in a cycle without a performance impact.

But you are right for generic actions they use standard algorithms and that is ok. But there are better algorithms for more specific cases.

And is also true in cases too many records a developer should never use list but instead use hash's.

Regards,

Marcelo

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.