<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/125444>125444</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Initialization of large arrays increases compilation time
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ohno-fj
</td>
</tr>
</table>
<pre>
```
Version of flang : 20.0.0(1c4341d176492da5f276937b84a3d0c959e4cf5b)/AArch64
```
Initialization of the large array in `type declaration statement` increases compilation time.
The array size is changed to eight patterns and the compilation time is measured with `time command`.
For all sizes, Flang takes longer to compile than Gfortran and ifx.
The compilation time of Flang increases as the array size increases.
Gfortran does not increase compilation time.
The result is:
|array size |flang |gfortran |ifx |
|-----------|---------|---------|---------|
|100 |0m0.598s |0m0.092s |0m0.037s |
|1000 |0m0.572s |0m0.067s |0m0.043s |
|10000 |0m0.610s |0m0.083s |0m0.033s |
|100000 |0m0.745s |0m0.061s |0m0.049s |
|1000000 |0m1.948s |0m0.099s |0m0.104s |
|2000000 |0m3.300s |0m0.092s |0m0.170s |
|4000000 |0m6.039s |0m0.096s |0m0.293s |
|8000000 |0m11.254s|0m0.078s |0m0.553s |
The above time is `user` of `time command`.
The following are the test program, Flang, Gfortran and ifx compilation/execution result.
sngtea44_2.f90:
```fortran
program main
real(4),dimension(8000000)::r1=0
end program main
```
```
$ time flang sngtea44_2.f90; ./a.out
real 0m11.111s
user 0m10.912s
sys 0m0.155s
$
```
```
$ time gfortran sngtea44_2.f90
real 0m0.135s
user 0m0.095s
sys 0m0.020s
$
```
```
$ time ifx sngtea44_2.f90
real 0m0.664s
user 0m0.571s
sys 0m0.051s
$
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUlc2OpDYQx5_GfbEGlb_4OHBge9VR7lGukRsK8AZwy3bPzuzTRwa6YZnJKkHdorD9r1_ZrrK196abEEuivhD19aTv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