Oddly slow compilation of character data with ifx

I see a pattern that when compiling with Intel ifx code containing large amounts of character data it compiles much slower than with other compilers. Fortran does not often
have huge amounts of such, but an extreme case that highlights this is that if I compile
the standalone version of the Fortran Intrinsic description viewer for people using environments without the man(1) command I see gfortran take around eight wallclock seconds and ifx take about 2 1/2 minutes.

https://raw.githubusercontent.com/lockstockandbarrel/mars/main/bootstrap/fman.f90

percentage-wise that code is mostly just text, which is uncommon for Fortran but wondering if that is worth getting addressed and/or if anyone sees such dramatic differences in compilation time? My hunch is that might be something straight-foward to fix and everyone has at least some text in their code.

Compile-time compilation of constants and constructors is slower with Intel Fortran than gfortran and other Fortran compilers. It is due to the way our front-end handles compile-time constants. There was a discussion on this recently on numeric data. It is the same with numeric and character compile time constants. We made a few minor tweaks but not enough to make much difference. This is nothing we can fix, it is deeply embedded in how we parse and initialize constants with our front-end. Without a major rewrite of our entire front end this cannot be sped up.

4 Likes

Thanks for drawing back the curtain. It helps to know what to expect so I can lay things out to account for the behavior. It is not producing non-performant executables or errors; just taking a bit more time to compile. And it saves me quite a bit of time not digging further.

I worked with codes that in the past required overnight batch jobs to compile, so even with a slow-down on a few codes I am amazed by how fast compilation is today overall. I wish I had kept a plot of the change in time. We have done that with execution times of standard problems on codes and looking at plots of the times drives home just how much computation we can do now compared to not very long ago in historic terms.

I am having the same problem with ifx and not ifort. 5 minutes with ifx and a few seconds with ifort. The files have a lot of character and integer constants. Breaking the files up into smaller files helps a lot but compilation is still slow.

I am nearly certain I saw very similar times between fix and fort. So unless memory is not serving me right that is unexpected. You are using the same compiler options and on the same machine?

Yes, I am using the same options on the same machine. The ifort compiler is an older 32-bit compiler and a 2024 64-bit ifx compiler is being used. The code is very simple and is mostly character and integer constants and subroutine calls.