Tim Bunce <[EMAIL PROTECTED]> wrote: > Aren't constant strings going to be saved in a way that lets the > address of the saved string be used to avoid string comparisons?
Constant strings get an entry in the constant_table. So for comparing 2 constant strings of the *same* code segment, strings differ, if their address differ. > (As is done for hash keys in perl5.) Perhaps that's already done. Not yet, but its worth to look at. > The byteloader could merge them into the global saved strings pool > and 'fixup' references to them in the bytecode. That's not possible generally. E.g. eval()ing a piece of code with varying string constants would grow the "global" string constants forever. > Perhaps a variant of a hash that worked with large integers (pointers) > as keys could be of some use here. That doesn't play well with dynamic code AFAIK. Namespace keys cane be string vars too. > The JudyL functions (http://judy.sourceforge.net/) provide a very > efficient 'integer hash'. I had a look at that some time ago, but the internals are horribly complex and it was leaking memory too. > Tim. leo