in reply to Re^4: Best complex structure?
in thread Best complex structure?
If I use the fetchall_arrayref, maybe it is not worth to change this structure?
It's still much easier and cheaper to traverse an array in order than a hash. So, if your hash keys are numeric, you almost certainly should be using an array instead.
does perl spend a lot of resources to create a strucure?
Different structures have different costs. Hashes are "more expensive" than arrays.
If your dealing with a few hundred or a few thousand items, the differences aren't worth worying about.
It's only when you start dealing with very large datasets, several 100 thousands or more, that the difference can becomes important.
But, re-sorting a hash everytime you traverse it, even with a few hundred elements is sufficiently costly that if you can avoid doing so by using an array, it doesn't make sense to not use the array!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Best complex structure?
by mat21 (Beadle) on Jun 09, 2005 at 18:19 UTC | |
by BrowserUk (Patriarch) on Jun 09, 2005 at 18:59 UTC | |
by mat21 (Beadle) on Jun 10, 2005 at 09:21 UTC | |
by BrowserUk (Patriarch) on Jun 10, 2005 at 11:42 UTC | |
by mat21 (Beadle) on Jun 10, 2005 at 13:04 UTC | |
| |
by planetscape (Chancellor) on Jul 03, 2005 at 11:22 UTC |