[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
centaur1.2 pretty printer
- Subject: centaur1.2 pretty printer
- From: prunet@oaxaca.inria.fr (Vincent Prunet)
- Date: 22 May 92 13:07:35 GMT
- Keywords: centaur, display, pseudo-colors
Answers to questions from a Centaur 1.2 user regarding pretty-print
performance.
--------------------------------
Q : The TYPOL pretty printer does not handle tabs in comments correctly.
This is true. Actually, none of the Built in languages handle tabs in
comments. The reason is that comments are printed as strings, and the
tab character is not printable.
In my opinion, the best correction would be to expand tabs to spaces
during the lex processing.
--------------------------------
Q : The pretty printers are slower than before, but that is supposebly
the effect of incremental pretty printing.
Not exactly. One must consider separately the formatting of abstract
syntax trees and the display. During the formatting, a rather large
data structure is built. During incremental formatting, this data
structure is incrementally updated. During display, no data structure
is built.
Using a centaur editor, the redraw button calls the format function
then redisplays the contents of the editor. The redisplay button only
redisplays the contents of the window. Of course, external expose
events due to the window system also cause redisplays.
Let us discuss the speed of the format and display functions.
-------
Format : I have compared the speed of the format function in
centaur1.1 and centaur1.2.
Machine : Sun 4/75
print level : 100
page width : 200
pretty printer : std
centaur/tables/ppml/ppml/std/PPML-std.ppml (392 lines)
centaur1.1 : 2.03 s
centaur1.2 : 1.8 s
centaur/tables/typol/semantics/TY_NGEN.ty (459 lines)
centaur1.1 : 5s
centaur1.2 : 3.68s
Remarks : In centaur1.2 the computed time includes the whole
deallocation/reallocation of resources (fonts, colors) and the cleanup
of the abstract syntax tree (many dangling pointers must be reset,
this is rather expensive when the old data structure is to be thrown
away, and should not happen usually).
Conclusion : The format time has been improved slightly when switching
from centaur1.1 to centaur1.2 (this is a good result if one considers
the improved quality of the output using external resources, fonts and
colors).
Incremental format : in this mode, previously computed resources are
recovered (no extra time is needed to fetch them), the data structure
is incrementally updated. The time required to format a modified tree
is roughly the time required to format modified subparts of the tree.
Incremental format is usually very fast in centaur1.2 (it was not so
efficient in centaur1.1). Moreover, the ability to compile lisp code
generated from a ppml specification (new feature of centaur1.2) has a
dramatic effect on tree traversal speed.
Write to a file : in this mode, no data structure is built. Most of
the time is spent traversing the tree. Compilation of pretty-printers
improve dramatically this function (I know I should give a bench here
... next time).
--------
Display : most of the display process is coded in C, with direct calls
to Xlib functions, and may be very fast. However, we wanted that users
of monochrome displays have the same ability to display text using
several "colors", and we introduced the concept of pseudo color (a
pseudo color is implemented as a color when in "color" visual-mode,
and as a pattern when in "mono" visual-mode).
Unfortunately, when in mono mode, this feature happens to be rather
time consuming!
The function current-visual returns the current mode which is either
color or mono. On a color display, the default mode is color, the
display is very fast. On a monochrome display, the default mode is
mono, then pseudo colors are implemented as patterns, and the display
is slow. The pattern mode can be switched off (allowing only black and
white as colors).
(current-visual)
-> current mode
(current-visual 'color)
-> switch to color mode (fast)
(current-visual 'mono)
-> switch to pattern mode (slow).
Warning : users are warned that color resources for centaur languages
have been tuned for real color display. When in color mode on a
monochrome display, it may happen that one writes with black ink on a
black foreground. In such a case, one should customize color resources
to get a convenient display.
Thank you for your remarks and bug reports.
--
Vincent Prunet, Sema Group Sophia Antipolis
INRIA BP 93 06902 SOPHIA ANTIPOLIS Cedex FRANCE
prunet@sophia.inria.fr, (33) 93 65 78 42, Fax:(33) 93 65 77 66