# Comparing Fortran and Julia's Bessel function performance

**URL:** <https://fortran-lang.discourse.group/t/comparing-fortran-and-julias-bessel-function-performance/4543>\
**Category:** Uncategorized\
**Created:** [October 16, 2022, 4:43pm UTC](https://fortran-lang.discourse.group/t/comparing-fortran-and-julias-bessel-function-performance/4543 "2022-10-16T16:43:29Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![rgba](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/rgba/32/2115_2.png) [@rgba](https://fortran-lang.discourse.group/u/rgba)\
**Post date:** [October 16, 2022, 3:28am UTC](https://fortran-lang.discourse.group/t/comparing-fortran-and-julias-bessel-function-performance/4543/14 "2022-10-16T03:28:59Z")

</div>

> [@heltonmc](#):
>
> I originally thought if I didn’t include some operation within the loop that the compiler would optimize the loop away

Mmm, which compiler flags are you using? With optimized flags I also would have that fear. Look at this answer, for a fairly similar example: [Why a function returns an array is much slower than a subroutine returns an array? (real MWE included) - #2 by Beliavsky](https://fortran-lang.discourse.group/t/why-a-function-returns-an-array-is-much-slower-than-a-subroutine-returns-an-array-real-mwe-included/1893/2) (spoiler, the function and the subroutine had the same performance, just the first call did not print nor did anything with the value so the compiler skipped it altogether :).

Of course you are getting the intended behavior with the flags you are using (or with no flags maybe). But if you intend to benchmark for speed feeding proper flags is crucial.

---

_[View the full topic](https://fortran-lang.discourse.group/t/comparing-fortran-and-julias-bessel-function-performance/4543)._
