>>>> "Hrvoje" == Hrvoje Niksic
<hniksic(a)srce.hr> writes:
> LIST_LOOP_3 itself is pretty cheap.
Hrvoje> Hmm, yes. It bothers my esthetic soul to know that every time a
Hrvoje> function is called its arglist is parsed in vain search of
Hrvoje> `&optional', `&rest', and stuff. It somehow doesn't
"feel right".
Hrvoje> Obviously, the yearnings of my soul needn't have anything to with the
Hrvoje> actual speed of the code. :-)
Truly, my soul has also agonized over this question.
The object-oriented way would be to have many different
compiled-function object types, each of which has a different
argument-parsing `method'.
Hrvoje> How much of the rest of what this URL describes have you
Hrvoje> implemented? The specbind() stuff in the source looks
Hrvoje> pretty much like the stuff Ben says we should have. The
Hrvoje> same goes for the massaged byte-code stuff, as well as for
Hrvoje> inlined unbind_to().
>
> The QUIT macro is no longer called.
> The arglist is only checked for proper-list-ness once.
> The other optimizations are not implemented.
Hrvoje> Looking at the code, I cannot believe that the specbind() optimization
Hrvoje> is not implemented. Also, I cannot believe that unbind_to()
Hrvoje> optimization is not implemented.
Oh, yeah, I also implemented specbind() and unbind_to() optimization.
Hrvoje> BTW, how do you obtain gprof output for a single benchmark?
>
> You build with -pg, run temacs, not xemacs, and run the benchmark in a
> loop a bazillion times.
Hrvoje> Ugly ugly ugly... WIBN if gprof supported something like
Hrvoje> gprof_start_recording() and gprof_stop_recording(), analogous to what
Hrvoje> quantify has?
Hrvoje> On Linux, where the source to gprof and libc are available, this might
Hrvoje> even be implementable! Yay!
binutils-2.9 contains some new information that might be of use here:
From gprof.info:
A special startup routine allocates memory for the histogram and
either calls `profil()' or sets up a clock signal handler. This
routine (`monstartup') can be invoked in several ways. On Linux
systems, a special profiling startup file `gcrt0.o', which invokes
`monstartup' before `main', is used instead of the default `crt0.o'.
Use of this special startup file is one of the effects of using `gcc
... -pg' to link. On SPARC systems, no special startup files are used.
Rather, the `mcount' routine, when it is invoked for the first time
(typically when `main' is called), calls `monstartup'.
If the compiler's `-a' option was used, basic-block counting is also
enabled. Each object file is then compiled with a static array of
counts, initially zero. In the executable code, every time a new
basic-block begins (i.e. when an `if' statement appears), an extra
instruction is inserted to increment the corresponding count in the
array. At compile time, a paired array was constructed that recorded
the starting address of each basic-block. Taken together, the two
arrays record the starting address of every basic-block, along with the
number of times it was executed.
The profiling library also includes a function (`mcleanup') which is
typically registered using `atexit()' to be called as the program
exits, and is responsible for writing the file `gmon.out'. Profiling
is turned off, various headers are output, and the histogram is
written, followed by the call-graph arcs and the basic-block counts.