On Mon, 21 Apr 2003, Nicolas Cannasse wrote:
> > Went through and changed all the inlined _setcdr calls to normal _setcdr
> > calls.
> Uh ! it took me some time to inlined them :'(
Then I wish you had asked me before doing so. As I'm opposed to it.
> > a) If we never call the function, why define it?
> It is called , it should actually be called when call - complexity is lower
> than O(n) since the overhead is not big.
Which is never in list functions, that I know about.
> > b) function calls aren't that expensive. And _setcdr is probably inlined
> > in most cases anyways.
> In native code, there is no problem with it.
> In bytecode, the speedups are around 20% and since we're working an on
> Standard library, it would be good to provide efficient code to the
> community, don't you think ? That's why after lots of benchs and differents
> versions I ended up inlining the calls.
Hmm. I'm less concerned about performance with bytecode. Bluntly, if you
want speed, go native. If you're going bytecode, you're giving up a lot
of speed anyways. But I'm still surprised it's not inlined in the
bytecode case as well. Just to check- you did use -inline, right?
> > c) In the future, when we have to change the magic incantation to make it
> > work, we only have to change it once, in _setcdr, and not all over.
> We will never have to do so.
I've yet to hear this in a case where it turned out to be so. And I
notice the changes are sneaking out of ExtList- I note that Enum has an
Obj.magic call which is effectively _setcdr. On my to-do list was to take
a long hard look at Enum.force to see if I could move that _setcdr back
into ExtList where it belongs.