# Grainsize, reduce\_sum, reduce\_sum\_static

**URL:** <https://discourse.mc-stan.org/t/grainsize-reduce-sum-reduce-sum-static/23510>\
**Category:** Modeling\
**Created:** [July 16, 2021, 10:28pm UTC](https://discourse.mc-stan.org/t/grainsize-reduce-sum-reduce-sum-static/23510 "2021-07-16T22:28:36Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![wds15](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/wds15/32/908_2.png) [@wds15](https://discourse.mc-stan.org/u/wds15)\
**Post date:** [July 17, 2021, 6:59am UTC](https://discourse.mc-stan.org/t/grainsize-reduce-sum-reduce-sum-static/23510/2 "2021-07-17T06:59:10Z")

</div>

> [@Understanding reduce\_sum efficiency](https://discourse.mc-stan.org/t/understanding-reduce-sum-efficiency/21102/10):
>
> Thanks, this is helpful. So the block sorting is “random” in the sense that there is no particular reason for the way the blocks end up being sequenced, but they nonetheless end up in some overall sequence. For dataset construction purposes then, you can just pick an order that is a mixture of group sizes and probably end up with something reasonably optimal, if I am reading you correctly. In terms of exactly which group order ends up being truly optimal within that general approach, that’s so…

---

_[View the full topic](https://discourse.mc-stan.org/t/grainsize-reduce-sum-reduce-sum-static/23510)._
