I tried to bench 3 methods to group data: native js (with underscore), group and Aggregate with $group
I uses these datas (genre/position' trees in Paris) (237 168 rows, 35Mo)
This is my script test and the result is a bit surprising !
┌─────────────┬───────────────┐
│ Method │ avg time (ms) │
├─────────────┼───────────────┤
│ Pure js │ 897 │
├─────────────┼───────────────┤
│ Group │ 3863 │
├─────────────┼───────────────┤
│ Aggregation │ 364 │
└─────────────┴───────────────┘
Why grouping with group is 10x slower than Aggregation ? For what is used "Group" ? And how can i optimise again my request ?
Thanks.