# Computing at compile time

**URL:** <https://fortran-lang.discourse.group/t/computing-at-compile-time/3044>\
**Category:** Uncategorized\
**Created:** [March 24, 2022, 8:26pm UTC](https://fortran-lang.discourse.group/t/computing-at-compile-time/3044 "2022-03-24T20:26:06Z")\
**Posts on this page:** 1\
**Showing post:** 41

<div class="post-metadata">

**Author:** ![msz59](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@msz59](https://fortran-lang.discourse.group/u/msz59)\
**Post date:** [March 27, 2022, 4:06pm UTC](https://fortran-lang.discourse.group/t/computing-at-compile-time/3044/41 "2022-03-27T16:06:38Z")

</div>

There is a recent thread [79 languages…](https://fortran-lang.discourse.group/t/79-languages-speed-competition-can-we-make-fortran-win/3038/17) regarding a benchmark of several languages in getting prime numbers less than 1 million. For this who do not follow it, there is a leading group of three (Lisp, C++, D) which outperform the remaining competitors by several orders of magnitude (!).  
A [comment](https://fortran-lang.discourse.group/t/79-languages-speed-competition-can-we-make-fortran-win/3038/15) by @Jweber puts those strange results into context of this topic by noting that the C++ winner uses constant expressions extensively, so _there was not much to do at run time._ I wonder how @Arjen-@mecej4 code would do in that benchmark but to check that, one would have to use nagfor, which, according to what we already know, is the only compiler possibly able to make it with `N=10**6`. Maybe @themos?  
The bad news is that the C++ _constexpr_ code (for N=10\*\*6) compiles with GNU `g++-11` in 7 seconds only.

---

_[View the full topic](https://fortran-lang.discourse.group/t/computing-at-compile-time/3044)._
