[Mailman-Developers] Speeding up Mailman
Barry A. Warsaw
bwarsaw@cnri.reston.va.us (Barry A. Warsaw)
Fri, 29 Oct 1999 11:12:08 -0400 (EDT)
Here's a bit of low-hanging fruit that might speed up Mailman. I
don't know exactly by how much, but it works by starting Python with
the -S option. On my Sparc boxes I've seen 4-8x improvement in the
startup times of the Python executable. I've tested the patch in that
I'm sure it works, but I haven't put it in the python.org operation
system yet. I plan on doing that next.
Note that this only works for the CGI and mail wrappers, not the
bin scripts, but it should still help out a lot.
Let me know if you give this a shot, and whether you see any
improvement or not. Thanks to Jeremy Hylton for the inspiration.
-Barry
-------------------- snip snip --------------------
Index: common.c
===================================================================
RCS file: /projects/cvsroot/mailman/src/common.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -c -r1.18 -r1.19
*** common.c 1999/07/12 20:32:59 1.18
--- common.c 1999/10/29 15:06:43 1.19
***************
*** 196,212 ****
newenv[j] = NULL;
/* Now put together argv. This will contain first the absolute path
! * to the python executable, then the absolute path to the script,
! * then any additional args passed in argv above.
*/
! newargv = (char**)malloc(sizeof(char*) * (argc + 2));
! newargv[0] = python;
! newargv[1] = (char*)malloc(sizeof(char) * (
strlen(scriptdir) +
strlen(script) +
1));
! strcpy(newargv[1], scriptdir);
! strcat(newargv[1], script);
/* now tack on all the rest of the arguments. we can skip argv's
* first two arguments because, for cgi-wrapper there is only argv[0].
--- 196,215 ----
newenv[j] = NULL;
/* Now put together argv. This will contain first the absolute path
! * to the Python executable, then the -S option (to speed executable
! * start times), then the absolute path to the script, then any
! * additional args passed in argv above.
*/
! newargv = (char**)malloc(sizeof(char*) * (argc + 3));
! j = 0;
! newargv[j++] = python;
! newargv[j++] = "-S";
! newargv[j] = (char*)malloc(sizeof(char) * (
strlen(scriptdir) +
strlen(script) +
1));
! strcpy(newargv[j], scriptdir);
! strcat(newargv[j], script);
/* now tack on all the rest of the arguments. we can skip argv's
* first two arguments because, for cgi-wrapper there is only argv[0].
***************
*** 218,227 ****
*
* TBD: have to make sure this works with alias-wrapper.
*/
! for (i = 2; i < argc; i++)
! newargv[i] = argv[i];
! newargv[i] = NULL;
/* return always means failure */
(void)execve(python, &newargv[0], &newenv[0]);
--- 221,230 ----
*
* TBD: have to make sure this works with alias-wrapper.
*/
! for (i=2, j++; i < argc; i++)
! newargv[j++] = argv[i];
! newargv[j] = NULL;
/* return always means failure */
(void)execve(python, &newargv[0], &newenv[0]);