JuliaLang / Microbenchmarks

Microbenchmarks comparing the Julia Programming language with other languages
https://julialang.org/benchmarks/
Other
88 stars 48 forks source link

Improved Fortran version of hex_string #67

Closed xecej4 closed 2 years ago

xecej4 commented 2 years ago

Suggested replacement for subroutine hex_string in file perf.f90 :

! Convert an integer to a hex string
!
subroutine hex_string(dec,hexchar)
  integer, intent(in) :: dec
  character(*) :: hexchar

  integer :: i, quotient

  character(len=1), parameter :: table(0:15) = &
  [(char(i),i=ichar('0'),ichar('9')),(char(i),i=ichar('A'),ichar('F'))]

  quotient = dec
  hexchar  = '00000000'
  i = 8
  do while (quotient /= 0 .and. i > 0)
      hexchar(i:i) = table(iand(quotient,15))
      i = i-1
      quotient = ishft(quotient,-4)
  end do

end subroutine hex_string

On my PC, this replacement reduced the run time of the parse_integers benchmark from 0.130 s to 0.047 s.

acxz commented 2 years ago

Please make a PR so that we can confirm the results in the CI.

xecej4 commented 2 years ago

Where do I make a PR, and what is "the CI"? I am an infrequent user of Github.

oscardssmith commented 2 years ago

PR stands for pull request. By making one, it will trigger an automatic benchmark run (CI).

xecej4 commented 2 years ago

Ah, I thought PR meant "problem report", as on Bugzilla, etc.

oscardssmith commented 2 years ago

abbreviations strike again.

xecej4 commented 2 years ago

I tried to make a new pull request, but failed. I was asked to choose a tag, etc., but I have no idea what to choose or what the existing branches are. Just not ready for the dungeons of Github, I suppose. I do not understand the terminology.

oscardssmith commented 2 years ago

Does this look correct to you https://github.com/JuliaLang/Microbenchmarks/pull/68?