lfortran / lcompilers_frontend

The sources of the web LFortran GUI interface

Home Page:https://dev.lfortran.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Caching issues in frontend compilation / execution timing output

HaoZeke opened this issue · comments

          Also, I observed the following:

Example:

program expr2
    implicit none

    integer :: x, cnt
    real :: y, z
    z = 2.5
    cnt = 0
   
    do x = 1, 1000000000
        y = z * z
        y = y * y
        cnt = cnt + 1
    end do

    do x = 1, 1000000
        y = z * y + y
        cnt = cnt + 1
    end do
    
    print *, x, cnt
end program

Ouptut:

1000000 1001000000

Compilation time: 11 ms
Execution time: 2070 ms

The execution time is as expected.

Now, if we press the run button again (without any change in the source code):
Output:

1000000 1001000000

Compilation time: 12 ms
Execution time: 369 ms

The execution time for further runs (without any change in the source code) comes to be around ~370 ms (which seems to be unexpected, I would expect it to be around atleast 1000ms). I guess that there is no actual execution taking place, and instead (since the source code is unchanged) values are being cached and displayed on the output. We need to see/investigate what is actually causing it.

On changing the source code, and then pressing the run button, the execution time seems to be as expected.

Originally posted by @Shaikh-Ubaid in #74 (comment)