Benjamin Goldberg <[EMAIL PROTECTED]> wrote: > How often, in practice, is the Stack_cleanup_method cleanup thingneeded?
I don't know and can imagine a usage for the cleanup code. A stack_push takes 45 instructions, the flag test is 5, setting the cleanup is 2 (i386). So we could save 7 of 45.
The flags field is, as pointed out, pretty redundant for this, and having it buys us nothing. I'm yanking it and I'll check in the changes when it's tested out OK. We can always add it in later if we need it.
> Possibly, the overhead of doing the tests for a cleanup function couldbe avoided by making a new Stack_entry_type value, soley for cleanup functions.
Still better.
The point of having a cleanup function was so that code could push entries onto the stack of various types and have their cleanup functions invoked when they were popped, with the value in the entry as a validated parameter.
I could go for a separate set of cleanup and non-cleanup entry types, though I'm not sure it'll be enough of a win to warrant the extra code. Until we have a more complete user of the engine we won't know.
> For a more revolutionary idea for speeding up save[insp] andrestore[insp], consider having a seperate stack for each type,
This would save another 7 instructions (setting the type and the switch). OTOH it would increase overall code size. I don't know if its better.
I don't want to go with extra stacks. That's a lot of overhead and memory. -- Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk
