# Improving a Program Implementing findall Function

**URL:** <https://discourse.julialang.org/t/improving-a-program-implementing-findall-function/40938>\
**Category:** Performance\
**Created:** [June 7, 2020, 4:26pm UTC](https://discourse.julialang.org/t/improving-a-program-implementing-findall-function/40938 "2020-06-07T16:26:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnrickmanz](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@johnrickmanz](https://discourse.julialang.org/u/johnrickmanz)\
**Post date:** [June 7, 2020, 4:26pm UTC](https://discourse.julialang.org/t/improving-a-program-implementing-findall-function/40938/1 "2020-06-07T16:26:40Z")

</div>

I recently seen topics here that says the findall function is quite slow and I think so too most likely if I am dealing with large number of elements say hundreds of thousands or more. An example of what I want is as follows: Given an array of arrays say  
[[1] ; [3] ; [4] ; [2] ; [1, 4] ; [1, 3] ; [3, 4]; [2, 4] ; [1, 3, 4] ; [2, 3, 4] ].  
Then for each element in the array I get the combinations taken (length - 1) and find its indices. For example, combinations taken 1 for [1, 4] is [1] and [4] which has indices 1 and 3 respectively in the array. Also, combinations taken 2 for [1,3,4] is [1, 3], [1, 4], and [3, 4] which has indices 6, 5, and 7 respectively. Is there an alternative for using findall function especially if you are dealing with 200,000 or more elements in the array? Thank you for any suggestion or answer.

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [June 7, 2020, 6:29pm UTC](https://discourse.julialang.org/t/improving-a-program-implementing-findall-function/40938/2 "2020-06-07T18:29:00Z")

</div>

`permutations` in the `Combinatorics.jl` package iiuc.  
But if you have something of length 200,000 and you take pairs of those, good luck fitting the result in your computer’s memory.
