CNCLgithub / GenRFS

Unofficial implementation of Random Finite Sets for Gen.jl
GNU General Public License v3.0
0 stars 0 forks source link

avoid `materialize` in `ins_kernel!` #26

Open belledon opened 1 year ago

belledon commented 1 year ago

https://github.com/CNCLgithub/GenRFS/blob/a57be71f29328bf98f11793f844eff76116d59ab/src/tree_walk.jl#L61

leads to a call to materialize

1518 (17 %) | 1518 (100 %) samples spent calling materialize
    ecs = count.(eachcol(partition)) .+ 1

one option would be to manually allocate ecs. we could instead flip the order in the nested for loop with elements iterated in the outer loop with ecs computed as a scalar.

there also appears to be some confusing syntax on (redundant assignment?) https://github.com/CNCLgithub/GenRFS/blob/a57be71f29328bf98f11793f844eff76116d59ab/src/tree_walk.jl#L69 and https://github.com/CNCLgithub/GenRFS/blob/a57be71f29328bf98f11793f844eff76116d59ab/src/tree_walk.jl#L80-L81