# Vector filtering performance and... gc?

**URL:** <https://discourse.julialang.org/t/vector-filtering-performance-and-gc/12295>\
**Category:** General Usage\
**Tags:** performance\
**Created:** [July 10, 2018, 1:54pm UTC](https://discourse.julialang.org/t/vector-filtering-performance-and-gc/12295 "2018-07-10T13:54:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cstjean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstjean/32/1444_2.png) [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Post date:** [July 10, 2018, 1:54pm UTC](https://discourse.julialang.org/t/vector-filtering-performance-and-gc/12295/1 "2018-07-10T13:54:40Z")

</div>

I have `vecs::Vector{Vector{Float32}}` (really, the columns of a dataframe), each of which has `length` of 300000. I’m interested in the performance of `v[t]`, where `t` is a `BitVector`. I’m finding that performance is strangely bimodal. Why?

```julia
# t = rand(Bool, length(vecs[1]))
p = plot(ylim=[0.0003,0.001], legend=false)
gc_enable(false)
for i in 1:10
    plot!([@elapsed(v[t]) for v in vecs])
end
gc_enable(true)
p

```

![image](https://global.discourse-cdn.com/julialang/original/3X/3/2/32e9fbab2bd1b6d77dd7c3ccb602287d7c1a3f1b.png)

If I leave the gc on, I get more jumps

![image](https://global.discourse-cdn.com/julialang/original/3X/d/1/d164f5e5dab41556bd71909f6bf5baf594ddc30d.png)

In the above, `mean(t)` is 0.75, but it has long stretches of `true` and `false`. If I use `t = rand(Bool, length(vecs[1]))`, then the bimodality disappears.

![image](https://global.discourse-cdn.com/julialang/original/3X/4/3/4395d3bc8eb88bda4b6c6642a6aee4d828603a32.png)

Am I seeing memory hierarchy effects? GC generations?
