[imp] Re: [horde] horde/imp migration problems, cpu bound on solaris (fwd)

Vasilios Hoffman vhoffman01 at wesleyan.edu
Thu Apr 10 16:59:49 PDT 2003


Hi folks,

I've installed setup and verified phpa from IonCube.  It's working, and
caching things, and while I think my login page is faster my inbox display
is still taking a while.

I broke down and decided to find out what in particular was being so slow.
I just used fputs and such to write to a file on the server.  it's using
the following function to track time usage:

function getmicrotime()
{
  list($usec, $sec) = explode(" ",microtime());
  return ((float)$usec + (float)$sec);
}

which I stole from phpa's website.

A single load of:

/horde/imp/mailbox.php

takes about 4.5-6 seconds, and that's after it's been loaded a couple of
times and should be cached via phpa.

here's an example run (excuse the unclear notes, but I do include line
numbers which should be only slightly off thanks to the code I inserted):

Top of mailbox.php: 0.000151038169861, line 16
  end of function definitions: 0.000332951545715, line 85
  end require_once: 0.568125009537, line 108
  end checkAuthentication(): 1.07391905785,line 117
  initialize identities: 1.07466304302, line 159
  about to run through the action handlers: 1.07507896423, line 166
  done running through the action handlers: 1.07539904118, line 384
  begin IMP::flistSelect: 1.07555103302, line 390
  end IMP::flistSelect: 3.6760610342, line 394
  begin some inbox sorting: 3.67635095119, line 399
  end sorting: 3.67826700211, line 447
  end page logic: 3.67850601673, line 563
  end some other stuff: 3.69362401962, line 600
  done with requires of .inc: 5.43777596951, line 624
  about to build array of message info and sort order: 5.43799602985, line 628
  about to display message information: 5.45003604889, line 681
  now processing footer: 5.47204101086, line 910
  storing prefs: 5.49746406078, line 934
End of mailbox.php 5.50000596046, line 943


The 2 big, bad guys are IMP::flistSelect done here (with my code stuck
in, ~2.6 seconds):

if ($conf['user']['allow_folders']) {

    $timestamp = getmicrotime() - $script_start;
    fputs($profile,"  begin IMP::flistSelect: $timestamp, line 390\n");
    fflush($profile);

    $options = IMP::flistSelect(_("Messages to"), true, array($imp['mailbox']), null, true);

    $timestamp = getmicrotime() - $script_start;
    fputs($profile,"  end IMP::flistSelect: $timestamp, line 394\n");
    fflush($profile);
}

and the "requires of .inc" which are from where I marked "other stuff" to
where I marked "done with requires of .inc" (~1.75 seconds):

$timestamp = getmicrotime() - $script_start;
fputs($profile,"  end some other stuff: $timestamp, line 600\n");
fflush($profile);

require IMP_TEMPLATES . '/common-header.inc';
if ($browser->hasFeature('javascript')) {
    include IMP_TEMPLATES . '/mailbox/javascript.inc';
}
require IMP_BASE . '/menu.php';
require IMP_BASE . '/status.php';

if (!empty($conf['hooks']['quota']) &&
function_exists($conf['hooks']['quota'])) {
    echo call_user_func($conf['hooks']['quota'], $imp);
}

require IMP_TEMPLATES . '/mailbox/header.inc';
$navform = 1;
require IMP_TEMPLATES . '/mailbox/navbar.inc';
require IMP_TEMPLATES . '/mailbox/actions.inc';
if ($imp['mailbox'] != '**search') {
    include IMP_TEMPLATES . '/mailbox/message_headers.inc';
}

$timestamp = getmicrotime() - $script_start;
fputs($profile,"  done with requires of .inc: $timestamp, line 624\n");
fflush($profile);

So I'm going to dig around and see what's holding those up.  If you folks,
who are more familiar with the code, gather any bright ideas from this...
please let me know.

-V



More information about the imp mailing list