[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Impact of procedure aliases on performance
From: |
felix . winkelmann |
Subject: |
Re: Impact of procedure aliases on performance |
Date: |
Sat, 18 Jun 2022 19:36:21 +0200 |
> 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?)
If the compiler can be sure that your redefinitions refer to
the original "standard" procedures, then they will be optimized
similarly. To make sure this is the case compile your code inside
a module (or in "block" mode), or, simpler, redefine your aliases
as macros, that way you can be sure the final code contains
references to the primitives.
felix