I am profiling some code and i have a snapshot that looks like this:
The code is roughly this:
const createApply = (args)=>(element)=>{
a()
b()
}
Inside of _applyFilters
const apply = createApply(args)
elements.forEach(apply)
The anonymous function is the curried apply that is in the forEach(apply)
loop. Sometimes i only see the apply function with no a()
or b()
. Sometimes i see just a()
sometimes as you can see i see a bunch of a() b() a() b()...
.
There are no conditions or anything, both a()
and b()
are always called.
So, why do these (anonymous)
functions in my image vary so wildly in their lenghts? Why do they have different amount of children (1,2,3 many…)? Why are there gaps?
Why isn’t it a dense table of anonymous->a(),b()
of equal lenghts and no gaps? All these functions do is access some dictionaries and write the values to some sets.