in reply to Efficiency and Large Arrays
If you're creating a new hash already, you can use its reference (yes, you read that right) as a unique ID. (I've seen this used as keys for a Flyweight object, pretty cool!) They're guaranteed to be unique, as they have something or other :) to do with memory locations:
You can get rid of everything except the hex digits with a simple tr/// statement: tr/a-f0-9//dc;. That's quicker than scanning for unique numbers.]$ perl my $h_ref = {}; print "$h_ref\n"; HASH(0x80d761c)
Still, there's something I can't quite put my finger on here... perhaps you could show us your intended data structure?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Efficiency and Large Arrays
by fundflow (Chaplain) on Jul 23, 2000 at 03:22 UTC | |
by chromatic (Archbishop) on Jul 23, 2000 at 04:01 UTC | |
by fundflow (Chaplain) on Jul 23, 2000 at 05:19 UTC | |
|
Re^2: Efficiency and Large Arrays
by diotalevi (Canon) on Dec 12, 2002 at 14:51 UTC |