Quantcast
Channel: Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2583

Inefficient code for simple string comparison

$
0
0

The following reproducer exposes an inefficiency with string comparisons. The compiler generates a call to for_cpstr() that consumes substantial compute time for a case I have. Tried with versions 11.1 and 13.1 and get the same assembly code. What is that call good for ? The compiler should be able to do much better with such a simple piece of code.

subroutine scmp(a,b,l, flag)

  character(*), intent(in) :: a
  character(*), intent(in) :: b
  integer, intent(in)  :: l
  logical, intent(out) :: flag

  if (a(1:l) == b(1:l)) then
    flag = .true.
  else
    flag = .false.
  end if

end subroutine scmp


Viewing all articles
Browse latest Browse all 2583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>