in reply to best structure for classes?
On the other hand, it's a lot more convenient to look things up by key in a hash when you're dealing with stuff that lends itself to being named and accessed out of a particular order.
Having to iterate over an array to find an appropriate element repeatedly can kill the performance benefits.
Pseudohashes are one solution, but they're not widely used or appreciated, so it's hard to recommend them. A better approach is to use the constant pragma to alias array indexes to names, and only access them through the names. This has the additional benefit or drawback of not allowing autovivification of hash keys within the object.
Most of what I use are hashes. Speed of data member access isn't a bottleneck for most of my stuff.
(Oh, and passing around a blessed reference doesn't make any difference in this case. The underlying access mechanisms do.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: best structure for classes?
by Rhandom (Curate) on Apr 20, 2001 at 00:13 UTC |