GMT 4.5.9 faster than 6.4?

Hi everyone,

I’m working on updating some code from an older version to 6.4, and I noticed that when I run the code with the new version it is slower, not something huge, but it’s like 4 secs slower than before. Is this the usual behavior? I just changed what I had to on syntax, nothing more, the code is pretty much the same.

Thanks in advance :slight_smile:

Hi @VEXEnzo – do you have some sample code so I can try to reproduce the problem?

Hi, thanks for the help. I will leave here a bit of the code and explain what is the objective as well leaving an image that is the expected result.

gmt psbasemap -R$region -JX15/5 $ba -X3.0 -Y7.0   -K >! $outfile

#POINTS

if ($nobs == 0) then

  cat $siterad | awk '{printf("%10.5f %10.5f\n",$1,$2)}' > tempf.$site.$$

  gmt psxy tempf.$site.$$ -R -JX -Sc0.05 -G$cuo -O -K  >> $outfile

endif

#REC opcional

if ($e == 1) then

  if ((-e $siterec) && ($rec == 1)) then

    set REC = `cat $siterec`

    foreach epoch ($REC)

      set valepo = `echo $epoch $xmin $xmax | awk '{if (($1 > $2) && ($1 < $3)) print(1) ; else print (0)}'`

      set rep = 0

      if ($valepo) then

        foreach item ($rec_array_x)

          if ($item == $epoch) then

            set rep = 1

          endif

        end

        if ($rep == 0) then

          set rec_array_x = ($rec_array_x $epoch)

        endif

      endif

    end

    foreach item ($rec_array_x)

      echo $item $ymin >  tempf.$site.$$

      echo $item $ymax >> tempf.$site.$$

      gmt psxy tempf.$site.$$ -R -JX -W1p,orange,. -O -K  >> $outfile

    end

  endif

endif

The code I posted is just want produces the points on the graph and the dotted lines. There is ofc more code but again as I said on the original post I only really updated the GMT version and change from “psxy” to “gmt psxy” nothing more.

João, you have to understand that we can do nothing with that script. It’s full of $variables. Can you isolate the part that is slower and make a reproducible example?

We have this old issue but the complain then was that GMT5 was slower than GMT4.

Given the generic rewrite of i/o in GMT 5 it is no mystery that 5 and 6 are slower at the expense of greater flexibility such as making GMT/MEX, pyGMT and GMT.jl possible.

But are you saying that plotting those 3 subplots takes reasonably more than 4 sec such that those extra ~4 sec are perceived as a slow down?

It’s not a huge difference, it’s slower, but nothing that I would consider a problem in any sense. Just wanted to know if it was “normal” for this little performance hit to happen.

Thanks for helping out, I got what I wanted :slight_smile:

Tell us if GMT.jl version of that script takes more than 2 secs.