chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Impact of procedure aliases on performance


From: Tirifto
Subject: Impact of procedure aliases on performance
Date: Sat, 18 Jun 2022 14:58:27 +0000

Hello everyone!

Brand new Chicken user here. I know a little bit of Scheme, but haven’t
touched this implementation before. What makes me curious about it is
the availability of many eggs and the ability to develop and distribute
cross-platform programs with them. (I gather the compilation to C plays
a major role in this.) And overall nice vibes so far. :-)

I’ve been looking at the tutorial ‘Programming for Performance’ [1],
and I have a question related to the following part:

  do not allow redefinition of standard procedures - this is the most
  crucial requirement, as all further special treatment of primitive
  operations depends on the compiler being able to assume that + still
  means addition everywhere

From this last bullet point and the surrounding text, I assume that the
Chicken compiler may treat some pre-defined procedures (such as ‘+’ or
‘-’) in a special way, to allow for better optimisation, and that it
might be a good idea to avoid changing their meaning.

What I would like to know is whether the opposite is true: if I define
a custom name to refer to a pre-defined procedure, can I expect it to
get the same kind of special treatment from the compiler? For example,
if I put the following expressions in my code:

  (define ≤ <=)
  (define ≥ >=)
  (define × *)

Will then calling ‘≤’, ‘≥’, or ‘×’ perform just as well as if ‘<=’,
‘>=’, or ‘*’ were called instead? Or will any kind of special treatment
the compiler may give to some names not extend to custom names of
equivalent meaning? (And if the latter is true, are there any better
ways to rename pre-defined procedures?)

I can easily imagine my assumptions being wrong, too. Any kind of
enlightenment on this matter would be appreciated. Thanks! ^ ^

Best of wishes
// Tirifto

-----------------------------------------------------------------------
1. https://wiki.call-cc.org/programming-for-performance



reply via email to

[Prev in Thread] Current Thread [Next in Thread]