# Tail recursive loops and closures

**URL:** <https://discuss.ocaml.org/t/tail-recursive-loops-and-closures/10845>\
**Category:** Learning\
**Tags:** performance\
**Created:** [November 22, 2022, 4:17pm UTC](https://discuss.ocaml.org/t/tail-recursive-loops-and-closures/10845 "2022-11-22T16:17:55Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![anuragsoni](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/anuragsoni/32/1107_2.png) [@anuragsoni](https://discuss.ocaml.org/u/anuragsoni)\
**Post date:** [November 22, 2022, 4:30pm UTC](https://discuss.ocaml.org/t/tail-recursive-loops-and-closures/10845/2 "2022-11-22T16:30:22Z")

</div>

I don’t know much (anything) about compiler internals/inlining, but after reading the responses for a similar question [Local functions and performance - #3 by vlaviron](https://discuss.ocaml.org/t/local-functions-and-performance/9644/3) I had started using the first style in your post for writing my inner loop functions, and if the task at hand was otherwise something where I cared enough to write a microbenchmark for that could show a difference in allocations. 😅

---

_[View the full topic](https://discuss.ocaml.org/t/tail-recursive-loops-and-closures/10845)._
