in reply to Hashes/Scalars and Memory Usage
The long answer: Any scalar variable is stored in an SV internally. A hash is just a container around a bunch of SV's. I don't know if either method will be necessarily "less efficient" (are you talking about memory or execution time?). On one hand you have the hash lookup to find the value you're looking for in a hash, and on the other hand you have a symbol table lookup for individual scalars (though I guess different variable scoping conventions could make that work differently -- someone else may be able to provide more information).
I honestly don't think there's any serious gain one way or the other, and as a Perl developer you shouldn't have to worry about such a thing, especially with only 30 variables. Use what makes the most sense in your code, but avoid playing tricks with soft references that could come around and bite you in the ass later on. Hope this helps.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Hashes/Scalars and Memory Usage
by EvilTypeGuy (Initiate) on Feb 09, 2001 at 01:06 UTC | |
by Fastolfe (Vicar) on Feb 09, 2001 at 02:44 UTC | |
by EvilTypeGuy (Initiate) on Feb 10, 2001 at 02:14 UTC | |
|
Re: Re: Hashes/Scalars and Memory Usage
by EvilTypeGuy (Initiate) on Feb 09, 2001 at 01:01 UTC | |
|
Re: Re: Hashes/Scalars and Memory Usage
by EvilTypeGuy (Initiate) on Feb 13, 2001 at 03:59 UTC |