[5785] in Athena Bugs
vax 7.1D: viewscribe is too slow on startup
daemon@ATHENA.MIT.EDU (Ezra Peisach)
Tue Aug 21 11:12:37 1990
To: bugs@ATHENA.MIT.EDU
Date: Tue, 21 Aug 90 11:12:21 EDT
From: Ezra Peisach <epeisach@ATHENA.MIT.EDU>
System name: valhalla
Type and version: CVAXSTAR 7.1D (1 update(s) to same version)
Display type: SM
What were you trying to do?
Use viewscribe
What's wrong:
It's memory inefficient on startup as it loads about 50 fonts
into the sever. Not only is this inefficient the first time it is
started, but it adds to swapping problems, etc.
What should have happened:
viewscribe should only load fonts as needed into the server.
Please describe any relevant documentation references:
viewscribe(1)
Known fix:
The following handles a better loading of the fonts. If we wanted to, we
could either add to the built in font list adding entries for all known
used fonts without sideaffects.
Startup time with these fixes approx 5 seconds. Original version about
20 seconds.
Ideally, an algorithm should be employed to determine fonts that are
recognized, obliterting the need for an internal font list expect for
exceptions and overrides.
Ezra
RCS file: RCS/SPBrowser.c,v
retrieving revision 1.1
diff -c -r1.1 SPBrowser.c
*** /tmp/,RCSt1002081 Tue Aug 21 11:10:34 1990
--- SPBrowser.c Tue Aug 21 11:03:41 1990
***************
*** 130,135 ****
--- 130,137 ----
parser; installed giveWarnings in PutWarning;
fixed major bug in code putting up message
that the file could not be opened.
+ 8/21/90 EZRA Modified to load fonts on need to use basis for
+ faster startup.
**************************************************************/
/*
***************
*** 255,261 ****
static struct _font_table font_table[NFONTS] =
{
! {"/Helvetica",10,"",0},
{"/Helvetica",12,"",0,0},
{"/Helvetica",13,"",0,0}, /* well... there isn't a 13 */
{"/Helvetica-Bold",10,"",0,0},
--- 257,263 ----
static struct _font_table font_table[NFONTS] =
{
! {"/Helvetica",10,"",0,0},
{"/Helvetica",12,"",0,0},
{"/Helvetica",13,"",0,0}, /* well... there isn't a 13 */
{"/Helvetica-Bold",10,"",0,0},
***************
*** 1568,1574 ****
--- 1570,1584 ----
}
+ #if 0
for (i=0;i<n_actual_fonts;i++)
+ #else
+ for (i=0;i<n_actual_fonts;i++) {
+ font_table[i].xfontstruct = NULL;
+ font_table[i].xfont = NULL;
+ }
+ for (i=0;i<1;i++)
+ #endif
if ((font_table[i].xfontstruct =
XLoadQueryFont(the_display,font_table[i].fontfile))
== NULL)
***************
*** 1763,1768 ****
--- 1773,1796 ----
i = DEFAULT_FONT;
}
cur_font = i;
+ if(!font_table[cur_font].xfont) {
+ #ifdef DEBUG
+ sprintf(msg, "Loading %s\n", font_table[cur_font].fontfile);
+ PutWarnMsg(msg);
+ #endif
+ if ((font_table[cur_font].xfontstruct =
+ XLoadQueryFont(the_display,font_table[cur_font].fontfile)) == NULL)
+ {
+ sprintf(msg, "Could not open font %s. ",
+ font_table[cur_font].fontfile);
+ strcat(msg,"Using default in browser");
+ PutWarnMsg(msg);
+ font_table[cur_font].xfontstruct = font_table[DEFAULT_FONT].xfontstruct;
+ font_table[cur_font].xfont = (font_table[DEFAULT_FONT].xfontstruct)->fid;
+ }
+ else
+ font_table[cur_font].xfont = (font_table[cur_font].xfontstruct)->fid;
+ }
XSetFont(the_display,the_GC,font_table[cur_font].xfont);
return(1);