octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #52809] interpreter performance is slow on dev


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #52809] interpreter performance is slow on development branch
Date: Tue, 9 Jan 2018 13:06:13 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Follow-up Comment #18, bug #52809 (project octave):

#16  What are your memories of the flaky cputime() function?  It does appear
there is a lot of overhead associated with the Octave cputime() routine,
considering that we are looking for as accurate a number as possible.  That
is, there is use of a fairly large object


  octave::sys::cpu_time cpu_tm;

  double usr = cpu_tm.user ();
  double sys = cpu_tm.system ();

  return ovl (usr + sys, usr, sys);


which in turn eventually uses


int
octave_cpu_time (time_t *usr_sec, time_t *sys_sec,
                 long *usr_usec, long *sys_usec)
{
  struct rusage ru;

  int status = getrusage (RUSAGE_SELF, &ru);

  if (status < 0)
    {
      *usr_sec = 0;
      *sys_sec = 0;

      *usr_usec = 0;
      *sys_usec = 0;
    }
  else
    {
      *usr_sec = ru.ru_utime.tv_sec;
      *usr_usec = ru.ru_utime.tv_usec;

      *sys_sec = ru.ru_stime.tv_sec;
      *sys_usec = ru.ru_stime.tv_usec;
    }

  return status;
}


I.e., unix system routine getrusage().  Of course, the unix getrusage() is
needed for  Octave's getrusage() routine.  However, I wonder if for cputime()
the code should try to be as minimal and direct as possible--maybe use some
static object as opposed to stack-based.  For example, there is

http://www.tutorialspoint.com/unix_system_calls/times.htm

which seems to provide the necessary info for cputime().  Perhaps the larger
getrusage() is a less efficient methodology and may have some peculiarities.

I don't know, there is a lot going on there for me to fully understand.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52809>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]