This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: thanks


On 6 Dec 1999, Lars Arvestad wrote:

> Does anyone have experience with extensive typechecking with respect
> to performance? I certainly would like the gh interface to do
> typechecking, and I would expect that the performance would *not*
> degrade linearly with the number of argument checks in libguile. 
> Wouldn't many of the checks be removed by an optimizing compiler 
> simply because they are superfluous? I mean, the compiler could
> recognize that a type is already guaranteed due to identical checks
> previously in the code.

Unfortunately, this would only be done if you were using macros (or inline
functions if those are available), but otherwise not across function
calls.  Thus, whenever you call a common function as scm_car, the type
checks would be performed, although in such a case (e.g when looping
through a list) you would in many cases know that the types are allright:
The null? test would also have to be performed by the calling function.

Otherwise, when within the same function, you are probably right:  In
these cases the compiler would hopefully do common subexpression
elimination, thus avoiding duplicate tests.  However, even when within the
same function, intermediate calls to possibly sideeffecting functions
additionally inhibit such optimizations.

Thanks for your answer.
Dirk Herrmann


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]