# Number of values in an array above a threshold

**URL:** <https://discourse.julialang.org/t/number-of-values-in-an-array-above-a-threshold/2167>\
**Category:** New to Julia\
**Tags:** question, performance\
**Created:** [February 18, 2017, 8:21am UTC](https://discourse.julialang.org/t/number-of-values-in-an-array-above-a-threshold/2167 "2017-02-18T08:21:57Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [November 27, 2020, 11:05pm UTC](https://discourse.julialang.org/t/number-of-values-in-an-array-above-a-threshold/2167/21 "2020-11-27T23:05:22Z")

</div>

After revising this thread, two observations if you will:

(i) The OP (@Andrea_Tersigni) seems to have accidentally deleted the original question?

(ii) The Julia’s adage that loops are fast, was not tested in examples above. For the record, the simple loop below seems to run faster for large N (say N \> 10^6):

```julia
function g6(r)
    x = 0 ::Int
    for i in r
        if i > 1.96
            x += 1
        end
    end
    return x
end

```

[Previous page](https://discourse.julialang.org/t/number-of-values-in-an-array-above-a-threshold/2167.md?page=1)
